I think somethings wrong with my compiler ...

Q

I think something's wrong with my compiler: I just noticed that sizeof('a') is 2, not 1 (i.e. not sizeof(char)).

✍: Guest

A

Perhaps surprisingly, character constants in C are of type int, so sizeof('a') is sizeof(int) (though this is another area where C++ differs).

2016-03-04, 568👍, 0💬