1, integer constant
In C language, integer constants are divided into decimal integer constants, octal integer constants and hexadecimal integer constants.
The above three binary constants can be used in different situations. Decimal constants are used in most cases, but when writing system programs, such as indicating addresses, octal or hexadecimal constants are often used.
Generally speaking, the compiler will distinguish whether a constant is an int type or a long int type according to its numerical value.
2. Real constant
There are two representations of real constants: one is decimal form, and the other is exponential form.
Integer constants and real constants:
1, integer constant In C language, integer constants are divided into decimal integer constants, octal integer constants and hexadecimal integer constants. The above three binary constants can be used in different situations.
Decimal constants are used in most cases, but when writing system programs, such as indicating addresses, octal or hexadecimal constants are often used. Generally speaking, the compiler will distinguish whether a constant is an int type or a longint type according to its numerical value.
2. There are two representations of real constants: one is a decimal form, and the other is an exponential form.
The rule is char, short-&; gtint-& amp; gt unsigned-& amp; gtlong-& amp; Double floating-&; Gtdouble so the comparison between integer and real data is to convert int into double and compare it.