A long constant is written with a terminal l or L (ie. 123456789L)
An unsigned constant is written with a terminal u or U
The suffix ul or UL indicates unsigned long
Floating-point constants contain a decimal point (123.4) or an exponent (1e-2) (double type unless suffixed)
The suffix f or F indicates floating constant
A leading 0 on an integer constant means octal
A leading 0x on an integer constant means hexadecimal
A character constant is an integer written as one character within single quotes (ie. 'x')
The value of character constant is the numeric value of the characters in the machine's character set (ie '0' has the value 48 in ASCII character set
Certain characters can be represented in character and string constants by escape sequences like \n newline
Complete set of escape sequence:
Character constant ' \0 ' represents the character with value zero - the null character
A string constant/literal is a sequence of zero or more characters surrounded by double quotes. ( ie. " Hello World" )
The internal representation of a string has a null character ' \0 ' at the end, so the physical storage required is one more than the written characters length
An enumeration is a list of constant integer values
The first name in an enum has value 0, the next 1, and so on, unless explicit values are specified
If not all values are specified, unspecified value continue progression from the last value
Enumeration associate constant value with name, an alternative to #define with auto-value generation advantage
No comments:
Post a Comment