C — Enums
Basic enum
enum Color { RED, GREEN, BLUE };
enum Color c = RED;
Custom values
enum Day { MON=1, TUE, WED, THU, FRI };
enum Day d = MON; // 1
Assign all
enum Status { OFF=0, ON=1 };
Mini Practice
- Create enum
- Use enum values
- Assign custom values
- Practice with switch
Up Next
Continue with Memory - Memory management.
Related Topics
Frequently Asked Questions about Enums
What is Enums in C?
Enums is a fundamental concept in C. This lesson explains it step by step with clear examples, making it easy for beginners to understand.
How do I learn Enums?
Start by reading the explanation above, then try the code examples. Practice by modifying the examples and experimenting with different values. Hands-on practice is the best way to learn Enums.
Why is Enums important in C?
Enums is essential for C development. Understanding this concept will help you write better code and solve real-world problems more effectively.