The C programming language has a set of functions implementing operations on strings (character strings and byte strings) in its standard library. Various operations, such as copying, concatenation, tokenization and searching are supported. For character strings, the standard library uses the convention that strings are null-terminated: a string of n characters is represented as an array of n + 1 elements, the last of which is a "NUL" character.
The only support for strings in the programming language proper is that the compiler translates quoted string constants into null-terminated strings.
A string is a contiguous sequence of code units terminated by the first zero code (\0
, corresponding to the null character). In C, there are two types of strings: string, which is sometimes called byte string which uses the type char
s as code units (one char
is at least 8 bits), and wide string which uses the type wchar_t
as code units.
A common misconception is that all char
arrays are strings, because string literals are converted to arrays during the compilation (or translation) phase. It is important to remember that a string ends at the first zero code unit. An array or string literal that contains a zero before the last byte therefore contains a string, or possibly several strings, but is not itself a string. Conversely, it is possible to create a char
array that is not null-terminated and is thus not a string: char
is often used as a small integer when needing to save memory.
Where are you
Cherry red , sweeter than the honeycomb
Sweeter still when we're alone
Cherry red, my cherry red
Turquoise green , greener than the deeper sea
Greener still when she's with me
Cherry red , my cherry red
I wonder why (wonder why)
The stars that night shine big and bright for me
I wonder why (wonder why)
She's true to me the way that she will always be
Cherry red , sweeter than the honeycomb
Sweeter still when we're alone
Cherry red , my cherry red
(break)
I wonder why (wonder why)
The stars that night shine big and bright for me
I wonder why (wonder why)
She's true to me the way that she will always be
Cherry red , sweeter than the honeycomb
Sweeter still when we're alone