Skip to content

Instantly share code, notes, and snippets.

@sutirthaC97
Created April 9, 2017 16:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sutirthaC97/80fb77ce6ac064320404bac99075efc5 to your computer and use it in GitHub Desktop.
Save sutirthaC97/80fb77ce6ac064320404bac99075efc5 to your computer and use it in GitHub Desktop.
Enum example in C program.
#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