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.
Loading...
Related Quiz
- The problem in which a derived class may inherit the same member more than once from a base class hierarchy is known as the _______ problem.
- Which file opening mode in C++ will allow you to append data at the end of the file’s content?
- To achieve runtime polymorphism in C++, _______ are used.
- What is the purpose of the modulus operator (%) in C++?
- The keyword _______ is used to access the base class’s members in the derived class.