0

Does anyone know the size of an enum?

If i have

enum foo
{
    YES,
    NO,
    MAYBE
};

is that 1 byte, but if i had 10 enumerations would that be 2 bytes, and so on? Thanks.

2
Contributors
1
Reply
2
Views
10 Years
Discussion Span
Last Post by Narue
0

>Does anyone know the size of an enum?

std::cout<< sizeof ( foo ) <<'\n';

>is that 1 byte, but if i had 10 enumerations would that be 2 bytes, and so on?
The number of constants doesn't change the size of the enum.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.