Re: about string and character
On Sat, 24 Nov 2007 17:31:43 +0000, Chris Dollin wrote:
> lovecreatesbea...@gmail.com wrote:
>
>> This string "0" consists of two characters.
>
> The nul terminator isn't one of the characters "in" a string.
From a common sense perspective:
char a[] = "0";
and
char a[] = { '0', '\0' };
do exactly the same thing, and common sense says that '\0' is "in" a in
the second case, so it must also be "in" a in the first.
From a standards perspective:
A string is defined as "a contiguous sequence of characters terminated by
and including the first null character".
|