Created
April 9, 2017 16:37
-
-
Save sutirthaC97/80fb77ce6ac064320404bac99075efc5 to your computer and use it in GitHub Desktop.
Enum example in C program.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main() | |
{ | |
enum weekdays{sun, mon, tue, wed, thu=121, fri, sat}; | |
enum weekdays sunday = sun; | |
enum weekdays friday = fri; | |
printf("sunday has the value: %d and friday: %d", sunday, friday);//Here friday has the value 122 because the previous const thu has the value of 121 whilst wed has the value of 3 because sun is initialized to zero. | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment