I have tried doing research through google and SO but I can only find results for sizeof('a')
which is type int
and thus should give me 4 bytes, but when I run this I get 1 byte (I think it might be because the link I have is a reference for C and not C++). HOWEVER what is interesting here is that when I type sizeof('aa')
I get 4 bytes. And anymore characters after aa
(for example aaa
or aaaa
) still gives me 4 bytes. Why is there a sudden increase in 3 bytes that remains constant with the addition of more chars? Also why does the sizeof(int) here give me 1 byte?
Thanks!