A.2.6 String Literals

A string literal, also called a string constant, is a sequence of characters surrounded by double quotes as in "...". A string has type "array of characters" and storage class static (see Par.A.3 below) and is initialized with the given characters. Whether identical string literals are distinct is implementation-defined, and the behavior of a program that attempts to alter a string literal is undefined.

Adjacent string literals are concatenated into a single string. After any concatenation, a null byte \0 is appended to the string so that programs that scan the string can find its end. String literals do not contain newline or double-quote characters; in order to represent them, the same escape sequences as for character constants are available.

As with character constants, string literals in an extended character set are written with a preceding L, as in L"...". Wide-character string literals have type "array of wchar_t." Concatenation of ordinary and wide string literals is undefined.

TCPL/A.02.6_String_Literals (last edited 2008-02-23 15:35:52 by localhost)

ch3n2k.com | Copyright (c) 2004-2022 czk.