Size of enum type

Let's consider the following example:

#include <iostream>

enum foo
{
typeA = 0,
typeB,
typeC

};

enum bar : typename uint64_t
{
typeD = 0,
typeE,
typeF

};

int main()
{
std::cout << "Size of <foo> type variable: " << sizeof(foo) << " bytes" << std::endl;
std::cout << "Size of <bar> type variable: " << sizeof(bar) << " bytes" << std::endl;

return 0;
}

Which should be the expected output?

Please, login to reply and check the correct answer.

Scroll to Top