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 |
simple program for virtual function?
What should malloc() do?
int a=1,b=2,c=3; printf("%d,%d",a,b,c); What is the output?
what is the difference between strcpy() and memcpy() function?
Which is not valid in C a) class aClass{public:int x;}; b) /* A comment */ c) char x=12;
EXPLAIN #INCLUDE<STDIO.H> EXPLAIN #INCLUDE<CONIO.H>
pgm to find middle element of linklist(in efficent manner)
though sbi was nationalized why its not comes under nationalized banks and its comes under publicsector banks
3 Answers State Bank Of India SBI,
Write a program to generate prime factors of a given integer?
Explain what will the preprocessor do for a program?
Write a c pgm for leap year
11 Answers College School Exams Tests, IBM, TCS,
what is ur strangth & weekness
0 Answers Cognizant, LG Soft, NetEnrich,