-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathenum.c
More file actions
43 lines (38 loc) · 859 Bytes
/
enum.c
File metadata and controls
43 lines (38 loc) · 859 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// // An example program to demonstrate working
// // of enum in C
// #include <stdio.h>
// enum year{Jan, Feb, Mar, Apr, May, Jun, Jul,
// Aug, Sep, Oct, Nov, Dec};
// int main()
// {
// for (int i = Jan; i <= Dec; i++)
// {
// printf("%d ",i);
// }
// return 0;
// }
// #include <stdio.h>
// enum State {Working = 1, Failed = 0, Freezed = 0};
// int main()
// {
// printf("%d, %d, %d", Working, Failed, Freezed);
// return 0;
// }
#include <stdio.h>
enum day
{
sunday = 1,
monday,
tuesday = 5,
wednesday,
thursday = 10,
friday,
saturday
};
int main()
{
printf("%d %d %d %d %d %d %d", sunday, monday, tuesday,
wednesday, thursday, friday, saturday);
// friday = 5.55, only int allowed
return 0;
}