How does C++ treat an enum regarding its type and size? 

  • As a float type with fixed size 
  • As an integer type with variable size 
  • As a class with member functions 
  • As a boolean type
Enums in C++ are treated as integer types. Their actual size can vary based on the compiler and the number of values they hold, but typically, they have the size of an int. C++11 introduced scoped enumerations (enum class) that offer better type safety, but fundamentally, they're still integers.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *