HP C A.06.05 Reference Manual

Program Organization
Constants
Chapter 2 29
Figure 2-1 String Constants
Like a character constant, a string constant can begin with the letter L to indicate that it is a
string constant in an extended character set.
To span a string constant over more than one line, use the backslash character (\), also called
the continuation character. The following, for instance, is legal:
strcpy(string,"This is a very long string that requires more \
than one line");
Note that if you indent the second line, the spaces will be part of the string.
The compiler concatenates adjacent string constants. Therefore, you can also span a string
constant over one line as shown:
strcpy(string, "This is a very long string that requires more "
"than one line");
When you indent the second line with this method, the spaces are not part of the string.
The type of a string is array of char, and strings obey the same conversion rules as other
arrays. Except when a string appears as the operand of sizeof or as an initializer, it is
converted to a pointer to the first element of the string. Note also that the null string, "" is
legal, and contains a single trailing null character.
10
A
3
h
2
s
5
r
4
o
76
t
9
t
8
s
11
i
r
12
n
13
g
14
\0
10