218 Chapter 10 Character Strings
consists of nine characters (not counting the terminating null): the character '\033', the
double quotation character '\"', the five characters in the word Hello, the double quo-
tation character once again, and the newline character.Try passing the preceding charac-
ter string to the stringLengthfunction to verify that nine is indeed the number of
characters in the string (again, excluding the terminating null).
A universal character nameis formed by the characters \ufollowed by four hexadecimal
numbers or the characters \Ufollowed by eight hexadecimal numbers. It is used for
specifying characters from extended character sets; that is, character sets that require more
than the standard eight bits for internal representation.The universal character name
escape sequence can be used to form identifier names from extended character sets, as
well as to specify 16-bit and 32-bit characters inside wide character string and character
string constants. For more information, refer to Appendix A.
More on Constant Strings
If you place a backslash character at the very end of the line and follow it immediately
by a carriage return, it tells the C compiler to ignore the end of the line.This line con-
tinuation technique is used primarily for continuing long constant character strings onto
the next line and, as you see in Chapter 13, βThe Preprocessor,β for continuing a macro
definition onto the next line.
Without the line continuation character, your C compiler generates an error message
if you attempt to initialize a character string across multiple lines; for example:
char letters[] =
{ "abcdefghijklmnopqrstuvwxyz
ABCDEFGHIJKLMNOPQRSTUVWXYZ" };
By placing a backslash character at the end of each line to be continued, a character
string constant can be written over multiple lines:
char letters[] =
{ "abcdefghijklmnopqrstuvwxyz\
ABCDEFGHIJKLMNOPQRSTUVWXYZ" };
It is necessary to begin the continuation of the character string constant at the beginning
of the next line because, otherwise, the leading blank spaces on the line get stored in the
character string.The preceding statement, therefore, has the net result of defining the
character array lettersand of initializing its elements to the character string
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
Another way to break up long character strings is to divide them into two or more adja-
cent strings. Adjacent strings are constant strings separated by zero or more spaces, tabs,