C Language Literals for numbers, characters and strings String literals


Example

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 other encoding prefixes, similar to L:

prefixbase typeencoding
nonecharplatform dependent
Lwchar_tplatform dependent
u8charUTF-8
uchar16_tusually UTF-16
Uchar32_tusually UTF-32

For the latter two, it can be queried with feature test macros if the encoding is effectively the corresponding UTF encoding.