What is the output for the program given below

typedef enum grade{GOOD,BAD,WORST,}BAD;
main()
{
BAD g1;
g1=1;
printf("%d",g1);
}

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is stack a keyword in c?

625


Why we use stdio h in c?

568


What are the application of c?

634


What is p in text message?

526


Explain modulus operator.

584






How can I manipulate individual bits?

594


Why we write conio h in c?

549


What is wild pointer in c with example?

566


How do c compilers work?

599


Can variables be declared anywhere in c?

608


What is struct node in c?

607


Can a function be forced to be inline? Also, give a comparison between inline function and the C macro?

646


explain what are pointers?

610


Can I initialize unions?

578


What is a stream?

636