Interview Questions

I think somethings wrong with my compiler

C Interview Questions and Answers


(Continued from previous question...)

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)).

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).

(Continued on next question...)

Other Interview Questions