What are the specifics of the definition of a string in C?

c1 is mostly [1] equivalent to &c1[0], which is holding one string, "CS".

There's a second string lurking in there, "324", starting at &c1[3] -- but as long as you access c1 as c1, the string "CS" is all the functions strcpy() et al. would see.


[1]: c1 is an array, &c1[0] is a pointer.


If you want to know the specifics of the definition of a string in C, go to the source.

From the C90 standard:

7 Library

7.1 Introduction

7.1.1 Definitions of terms
A string is a contiguous sequence of characters terminated by and including the first null character. A “pointer to” a string is a pointer to its initial (lowest addressed) character. The “length” of a string is the number of characters preceding the null character and its “value” is the sequence of the values of the contained characters, in order.

(There were no relevant changes in later standards.)

Thus, c1 contains two consecutive strings, "CS" and "324", but is not itself a string.

If we pass an array to a function, it decays to a pointer to its first element, thus +c1 points to a string (the first one), which is good enough for any function expecting a pointer to string. It doesn't point to a string "CS\0324", but that's probably good enough for your instructors question, which is ambiguous.