‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long unsigned int’ [-Wformat=] [duplicate]

sizeof returns size_t you need to use %zu for the format string instead of %d. The type of unsigned integer of size_t can vary (depending on platform) and may not be long unsigned int everywhere, which is covered in the draft C99 standard section 6.5.3.4 The sizeof operator paragraph 4: The value of the result … Read more

what is the size of an enum type data in C++?

This is a C++ interview test question not homework. Then your interviewer needs to refresh his recollection with how the C++ standard works. And I quote: For an enumeration whose underlying type is not fixed, the underlying type is an integral type that can represent all the enumerator values defined in the enumeration. The whole … Read more