Enumeration or enum is a user defined data type in C. It is mainly used to assign names to integral constants. The names make a program easy to read and maintain.
1. The keyword enum is used to define enumeration data types in C.
#include<stdio.h>
int main()
{
enum week day;
day=wed;
printf("%d",day);
return 0;
} you can also assign your own constant values
Example:
enum grade{first=60, second=50, third};
In the above example the value of third is zero.
0 comments :
Post a Comment
Note: only a member of this blog may post a comment.