### Question 8.9

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

Perhaps surprisingly, character constants in C are of type `int`, so `sizeof('a')` is `sizeof(int)` (though it's different in C++). See also question 7.8.

References: ANSI Sec. 3.1.3.4
ISO Sec. 6.1.3.4
H&S Sec. 2.7.3 p. 29

Read sequentially: prev next up top

This page by Steve Summit // Copyright 1995 // mail feedback