Tutorial by Examples

Integer literals are used to provide integral values. Three numerical bases are supported, indicated by prefixes: BasePrefixExampleDecimalNone5Octal00345Hexadecimal0x or 0X0x12AB, 0X12AB, 0x12ab, 0x12Ab Note that this writing doesn't include any sign, so integer literals are always positive. Somet...
String literals are used to specify arrays of characters. They are sequences of characters enclosed within double quotes (e.g. "abcd" and have the type char*). The L prefix makes the literal a wide character array, of type wchar_t*. For example, L"abcd". Since C11, there are ot...
Floating point literals are used to represent signed real numbers. The following suffixes can be used to specify type of a literal: SuffixTypeExamplesnonedouble3.1415926 -3E6f, Ffloat3.1415926f 2.1E-6Fl, Llong double3.1415926L 1E126L In order to use these suffixes, the literal must be a floating p...
Character literals are a special type of integer literals that are used to represent one character. They are enclosed in single quotes, e.g. 'a' and have the type int. The value of the literal is an integer value according to the machine's character set. They do not allow suffixes. The L prefix bef...

Page 1 of 1