Thursday, 10 June 2021

Enumerated data type or enum in C

 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.

Find Us On Facebook

Computer Basics

More

C Programming

More

Java Tutorial

More

Data Structures

More

MS Office

More

Database Management

More
Top