C enum

An enum is a user-defined datatype whihc can create user-defined data-type of integer.
An enum is keyword, by using enum we can create sequence of ineger constant value.
The size of the enumerator datatype is 2 bytes beucase it works like a integer.
All the properties of integer can be applied to enumerator data type.

Syntax:

enum tagname {const1=value, const2=value,….}

Example:

#include
enum abc {x,y,z};
void main()
{
a=x+y+z;
printf(“\n a=%d”,a);
printf(“\n x=%d y=%d z=%d”, x,y,z);
}

Powered by k2schools