why sizeof(‘a’) is 4 in C? [duplicate]
Because in C character constants, such as ‘a’ have the type int. There’s a C FAQ about this suject: Perhaps surprisingly, character constants in C are of type int, so sizeof(‘a’) is sizeof(int) (though this is another area where C++ differs).