A
Al Bowers
pete said:char s1[3] = "123";
In that case s1, satisfies the defintion for "pointer to a string"
N869
7.1.1 Definitions of terms
[#1] A string is a contiguous sequence of characters
terminated by and including the first null character. The
term multibyte string is sometimes used instead to emphasize
special processing given to multibyte characters contained
in the string or to avoid confusion with a wide string. A
pointer to a string is a pointer to its initial (lowest
addressed) character.
No.
Consider the declaration and initialization.
char s1[3] = "123";
You have declared an array of 3 characters and assigned the characters
'1','2','3' to this array. s1[0] has the value '1'. s1[1] has the
value '2'. s1[3] has the value '3'.
Where in this character array is there a contigous sequence of
characters terminated by and including the first null character?
Answer: There is no null character in the array, thus the array
does not represent a string.