char str[] = "a";
char ch = 'a';
speaking of the difference between the two, we all knowstr
point to a memory space which stored [a, \0], but I want to ask whether there is a difference between str[0]
and ch
?
char str[] = "a";
char ch = 'a';
speaking of the difference between the two, we all knowstr
point to a memory space which stored [a, \0], but I want to ask whether there is a difference between str[0]
and ch
?
but I want to ask whether there is a difference between
str[0]
andch
?
No.
str[0]
and ch
, both are of type char
, and hold the value 'a'
. From this aspect (type and value), there is no difference.