What is the output for the program given below
typedef enum grade{GOOD,BAD,WORST,}BAD;
main()
{
BAD g1;
g1=1;
printf("%d",g1);
}
Answers were Sorted based on User's Feedback
Answer / ashwin kumar
error is the answer as 2nd person answer
we can remove error by changing code as follows
typedef enum grade{GOOD,BAD,WORST,} bad;
main()
{
bad g1;
g1=1;
printf("%d",g1);
}
out is 1 for above code
actual error in 1st code is declearing same variable 'BAD'
at two place in enum
if my answer is wrong or any corrections are made by u plz
inform me
molugu.ashwin@gmail.com
| Is This Answer Correct ? | 3 Yes | 0 No |
Answer / fefrf
In linux you get following error
enum.c:2: error: `BAD' redeclared as different kind of symbol
enum.c:2: error: previous declaration of `BAD'
| Is This Answer Correct ? | 2 Yes | 0 No |
differentiate between const char *a; char *const a; and char const *a;
2 Answers College School Exams Tests, HCL, TCS,
what is linkage error when it occurs in c program
How to compare array with pointer in c?
Can a pointer be null?
What is unsigned int in c?
how to execute a program using if else condition and the output should enter number and the number is odd only...
What is the function of this pointer?
0 Answers Agilent, ZS Associates,
What is property type c?
Calculate 1*2*3*____*n using recursive function??
2.main { int x,j,k; j=k=6;x=2; x=j*k; printf("%d", x);
Find the output? void main() {float a=2.0; printf("\nSize of a ::%d",sizeof(a)); printf("\nSize of 2.0 ::%d",sizeof(2.0));}
11 Answers IBM, TCS,
Write any data structure program (stack implementation)