Possible Duplicate:
Size of character ('a') in C/C++
Can someone explain why in C sizeof(char)
= 1 and sizeof(name[0])
= 1 but sizeof('a')
= 4?
name[0]
in this case would be char name[1] = {'a'};
I've tried to read through C's documentation to get this but I simply don't get it! if sizeof('a')
and sizeof(name[0])
were both 4 I would get it, if they were both 1 that would make sense... but I don't get the discrepancy!