Afficher un message
Vieux 24/11/2007, 20h26   #10
$)CHarald van D)&k
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut 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".
  Réponse avec citation
 
Page generated in 0,05859 seconds with 9 queries