6.6 Constants
- Numeric
Decimal | 12345 |
Unsigned Decimal | 12345U | or u |
Long Integer | 123456789L | or l |
Unsigned Long Integer | 123456789UL | or ul |
Octal | 012345 | Leading 0 |
Hexadecimal | OxA4BC | I like lower case x |
Single Character | 'a' |
String, null terminated | "String" |
Floating Point | 1234f | or F |
Floating Point | 1234.234 |
Long Floating Point | .0012L | or l |
Exponential notation | 1234.234e-12 |
Exponential notation | 1e-12 | No . required. |
|
- Character
In single quotes. `a`
Special sequences:
\b | Backspace |
\f | Form feed |
\n | Newline |
\r | Carriage return |
\t | Horizontal tab |
\v | Vertical tab |
\\ | Backslash |
\? | Question mark |
\' | Single quote |
\" | Double quote |
\ooo | Octal number |
\xhh | Hexadecimal number |
|
- Strings
Sequence of characters terminated with a '\0'.
It is one longer in memory than the number of characters
in between the double quotes.
"Hello, "
"world"
and
"Hello, world"
are equivalent. This is useful for long, multi-line constants.
Instructor: Louis Taber, louis.taber.at.pima at gmail dot com (520) 206-6850
My web site in Cleveland, OH
The Pima Community College web site