[Study Notes] [C Language] in hexadecimal notation, learning notes in notation

Source: Internet
Author: User

[Study Notes] [C Language] in hexadecimal notation, learning notes in notation
1. What is hexadecimal

It is a counting method, which is a numerical representation.

2. Binary

1> features: only 0 and 1, every 2 to 1

2> writing format: starting with 0b or 0b

3> usage: binary commands \ binary files. variables are stored in binary memory.

4> mutual conversion between binary and decimal

5> n is the data range that can be expressed by binary bits (negative number is not considered): 0 ~ The Npower of 2-1

3. Gossip

1> features: 0 ~ 7. Every 8 hours

2> writing format: starting with 0

3> mutual conversion between octal and binary

4. hexadecimal

1> features: 0 ~ F

2> writing format: starting with 0x or 0X

3> hexadecimal and Binary Conversion

5. the printf format is output in different hexadecimal formats.

1 # include <stdio. h> 2 3/* 4% d \ % I decimal form output integer 5% c output character 6% p output address 7% f output decimal form output integer 8% x hexadecimal form output integer 10 11 */12 13 int main () 14 {15 // by default, it is 16 int number = 12; 17 18 // binary (starting with 0b or 0B) 19 int number2 = 0B1100; 20 21 // octal (starting with 0) 22 int number3 = 014; 23 24 // hexadecimal (starting with 0x or 0X) 25 int number4 = 0xc; 26 27 // % d output a value in the form of a 10-digit integer 28 printf ("% x \ n", number); 29 30 return 0; 31}

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.