C Programming - Structures, Unions, Enums - Discussion
Discussion Forum : Structures, Unions, Enums - Find Output of Program (Q.No. 6)
6.
What will be the output of the program ?
#include<stdio.h>
int main()
{
enum status {pass, fail, absent};
enum status stud1, stud2, stud3;
stud1 = pass;
stud2 = absent;
stud3 = fail;
printf("%d %d %d\n", stud1, stud2, stud3);
return 0;
}
Discussion:
24 comments Page 2 of 3.
Raghu said:
1 decade ago
Thats good explanation XYZ.
You should have write your name anyhow I am fully satisfied with that.
You should have write your name anyhow I am fully satisfied with that.
Chandan said:
10 years ago
@Manu.
Those are garbage value as you have not assigned any value to those variables.
Those are garbage value as you have not assigned any value to those variables.
Ranjith said:
2 decades ago
Know that enum values are initialising from 0 only how it would get 2 and 1
Deepak said:
8 years ago
Is there any run time, compile error in this program? Can anyone tell me?
Ghufran said:
1 decade ago
Simply enum start index from 0 by default if no any value is associated.
Sravz said:
1 decade ago
Thank you friends your explanations helped me to get it clear.
Krishna said:
2 decades ago
Because enum values are initialised from zero.
Manju said:
1 decade ago
How is possible? Please explain this program.
Nagaraju said:
1 decade ago
How can you say pass0, pass2, pass1 @Sundar.
Hari said:
1 decade ago
Thanks xyz.
I satisfied with your ans.
I satisfied with your ans.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers