String literals

suggest change

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:

prefix | base type | encoding | —— | —— |—— | none | char | platform dependent |L | wchar_t | platform dependent |u8 | char | UTF-8 |u | char16_t | usually UTF-16 |U | char32_t | usually UTF-32 |

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

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents