Enumeration in C language

Enumeration is used to create set of integer constants. Enumeration is similar to structure. Here, a constant name is provided for each constant value. we use enum keyword is used to prepare enumeration. 
एनुमरेशन का प्रयोग इन्टिजर कांस्टेंट का समूह तैयार करने के लिए किया जाता है, यह स्ट्रक्चर के सामान होता है। यहाँ प्रत्येक वैल्यू को एक कांस्टेंट नाम प्रदान किया जाता है। हम enum (एनुम) कीवर्ड का प्रयोग कर एनुमरेशन तैयार कर सकते है।  

Syntax :-
enum enumeration_name{
constant_name1=value 1,
constant_name2=value2,
constant_namen=value n
};

Examples :-
1.) enum mode{lastmode=-1, BW40=0, C40=1, BW80=2, C80=3, MONO=7};

2.) enum coins_cent{penny=1, nickle=5, dime=10, quarter=25, half=50, dollar=100, eagle=1000};

Variable of enumeration are prepared are as follows :-
एनुमरेशन का वेरिएबल निम्नानुसार तैयार किया जाता है -
enum coins_cent money;
money=eagle;

Comments

Popular posts from this blog

C Language Topics in Hindi and English

C language IMP Questions for BSc/BA/BCom/BCA/BE/BTech/MSc/MCA (CS/IT) I year students