C Interview Enums
C Interview Enums
Enums in C
Enums (short for enumerations) are used in C to assign names to a set of integer constants.
They improve code readability, avoid magic numbers, and help group related values
together.
Uses of Enums
1. Improved Readability:
5. Easier Maintenance:
7. Switch-Case Efficiency:
switch (direction) {
case NORTH: moveUp(); break;
case SOUTH: moveDown(); break;
}
Real-Life Example