|
| 1 | +<span class="hljs-comment">/* Floating-point literals. */</span> |
| 2 | +<span class="hljs-comment">// Decimal.</span> |
| 3 | +<span class="hljs-number">1.</span> |
| 4 | ++<span class="hljs-number">12.</span> |
| 5 | +<span class="hljs-number">1.2</span> |
| 6 | +<span class="hljs-number">1234e56</span> |
| 7 | + |
| 8 | +<span class="hljs-comment">// Hexadecimal.</span> |
| 9 | +<span class="hljs-number">0x1p2</span> |
| 10 | ++<span class="hljs-number">0x1.p2</span> |
| 11 | +<span class="hljs-number">-0X1A.P2</span> |
| 12 | +<span class="hljs-number">0x1.Ap2</span> |
| 13 | + |
| 14 | +<span class="hljs-comment">// Literal suffixes.</span> |
| 15 | +<span class="hljs-number">1.F</span> |
| 16 | + |
| 17 | +<span class="hljs-comment">/* Integer literals. */</span> |
| 18 | +<span class="hljs-comment">// Binary.</span> |
| 19 | ++<span class="hljs-number">0b1</span> <span class="hljs-comment">// Note: Not standard C, but valid in some compilers</span> |
| 20 | +<span class="hljs-number">0B</span>01 <span class="hljs-comment">// Note: Not standard C, but valid in some compilers</span> |
| 21 | + |
| 22 | +<span class="hljs-comment">// Hexadecimal.</span> |
| 23 | ++<span class="hljs-number">0x1</span> |
| 24 | +<span class="hljs-number">0X1A</span> |
| 25 | + |
| 26 | +<span class="hljs-comment">// Octal.</span> |
| 27 | ++<span class="hljs-number">01</span> |
| 28 | +<span class="hljs-number">012</span> |
| 29 | + |
| 30 | +<span class="hljs-comment">// Decimal.</span> |
| 31 | +<span class="hljs-number">0</span> |
| 32 | ++<span class="hljs-number">1</span> |
| 33 | +<span class="hljs-number">12</span> |
| 34 | + |
| 35 | +<span class="hljs-comment">// Literal suffixes.</span> |
| 36 | +<span class="hljs-number">0X2L</span> |
| 37 | +<span class="hljs-number">0x2l</span> |
| 38 | +<span class="hljs-number">03LL</span> |
| 39 | +<span class="hljs-number">03ll</span> |
| 40 | +<span class="hljs-number">4UL</span> <span class="hljs-number">4Ul</span> <span class="hljs-number">4uL</span> <span class="hljs-number">4ul</span> |
| 41 | +<span class="hljs-number">5LU</span> <span class="hljs-number">5Lu</span> <span class="hljs-number">5lU</span> <span class="hljs-number">5lu</span> |
| 42 | +<span class="hljs-number">6ULL</span> <span class="hljs-number">6Ull</span> <span class="hljs-number">6uLL</span> <span class="hljs-number">6ull</span> |
| 43 | +<span class="hljs-number">7LLU</span> <span class="hljs-number">7LLu</span> <span class="hljs-number">7llU</span> <span class="hljs-number">7llu</span> |
| 44 | + |
| 45 | +<span class="hljs-comment">// Character array.</span> |
| 46 | +<span class="hljs-type">char</span> word[] = { <span class="hljs-string">'3'</span>, <span class="hljs-string">'\0'</span> }; |
0 commit comments