char str[] = "a";
char ch = 'a';
speaking of the difference between the two, we all know str
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.