What is the primary purpose of using enum in C++? 

  • For iterating over collections 
  • For handling exceptions 
  • To create user-defined data types 
  • For memory management
The primary purpose of enum (short for "enumeration") in C++ is to create user-defined data types where you can define a set of named integer constants. It provides a way to assign names to integral constants, which makes a program easier to read and maintain.
Add your answer
Loading...

Leave a comment

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