In C language, integer constants can be expressed in the following three forms:
1, a decimal integer, is the normal expression of the digital form of daily contact. Such as 123,-120;
2, an octal integer, represented by a number beginning with 0. For example, 0 123 stands for octal number 123, that is, (123)8, and its value is 1*82+2*8 1+3*80, which is equal to decimal number 83. -0 1 1 means octal number-1 1, that is, decimal number -9.
3. Hexadecimal integer, represented by a number beginning with 0x. For example, 0x 123 represents hexadecimal number 123, that is, (123) 16, and its value is1*162+2 *16. -0x 12 equals the decimal number-18.
Extended data:
Real constant
In C language, real constants can only be expressed in decimal. It has two forms: decimal form and exponential form.
1, decimal form
It consists of symbols, numbers from 0 to 9 and decimal points. There cannot be numbers before and after the decimal point (it cannot be omitted at the same time). Such as:-1.85, 0.24, .426,-1 1.
2. Exponential form
It consists of decimal number plus rank code mark e or e and rank code. Its general form is aEn. Where a is a decimal number, n is a decimal integer ("+"can be omitted when n is a positive number), and its value is a× 10? .
For example, 1.236e+2 means1.236x10? .
Baidu encyclopedia-integer constant