C Programming - Structures, Unions, Enums - Discussion
Discussion Forum : Structures, Unions, Enums - Find Output of Program (Q.No. 5)
5.
What will be the output of the program ?
#include<stdio.h>
int main()
{
enum days {MON=-1, TUE, WED=6, THU, FRI, SAT};
printf("%d, %d, %d, %d, %d, %d\n", MON, TUE, WED, THU, FRI, SAT);
return 0;
}
Discussion:
31 comments Page 2 of 4.
Akanksha said:
1 decade ago
Enum is short form use for Enumerated data type definition. Correct me if I m wrong.
Chandresh said:
2 decades ago
This is because enum assigns to it's variable component sequential integer values.
Sagarika said:
1 decade ago
If there is ++mon intsead of mon, then what will be the output?
Murthy said:
7 years ago
It's clear to understand, Thanks @Karthika.
Karth said:
8 years ago
Yes, I agree with your concept @Karthika.
Gayathri said:
1 decade ago
Yes Karthiga, I agree with your concept.
Sahiti said:
1 decade ago
enum takes the size of int i.e 2 bytes.
Kamal said:
7 years ago
Yes, I agree @Karthika and @Akansha.
Gaurav shukla said:
1 decade ago
What is type of data member in enum?
Ramkesh said:
8 years ago
Nice Explanation, Thank You @Ramdas.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers