Enumerated Type, Example
#include <stdio.h>
main()
{
enum marital_status {
single, married,
divorced, widowed };
typedef enum marital_status MARITAL;
MARITAL s1, s2;
s1 = divorced;
s2 = single;
printf("\n%d\n", s1);
printf("\n%d\n", s2);
}
the program prints:
2
0
This is program
pg539.c
.
Previous slide
Next slide
Back to first slide
View graphic version