Numeric constants in C language have the following representation methods: decimal integer octal integer hexadecimal integer decimal floating point number scientific notation character constant boolean constant
The representation of numeric constants in C language
Numeric constants refer to values directly expressed in the program and will not change during program execution. . Numeric constants in C language have the following representation methods:
<code class="c">10 // 十进制整数 012 // 八进制整数 0x10 // 十六进制整数</code>
<code class="c">3.14 // 十进制浮点数 1.6e5 // 科学记数法</code>
<code class="c">'a' // 字符 'a'</code>
<code class="c">true // 布尔值 true false // 布尔值 false</code>
It should be noted that once a numeric constant in C language is declared, its type can no longer be changed. For example, if you assign a decimal integer to a floating-point variable, the decimal integer is implicitly converted to a floating-point number.
The above is the detailed content of How to express numerical constants in C language. For more information, please follow other related articles on the PHP Chinese website!