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 |
Is boolean a datatype in c?
How many types of errors are there in c language? Explain
Write any data structure program (stack implementation)
What is the difference between break and continue?
Why C language is a procedural language?
What are advantages and disadvantages of recursive calling ?
12 Answers College School Exams Tests, Evolving Systems, HP, Jyoti Ltd, Sage, Wipro,
Explain what are the advantages and disadvantages of a heap?
How to convert a binary number to Hexa decimal number?? (Note:Do not convert it into binary and to Hexadecimal)
What does static variable mean in c?
which operator is known as dummy operator in c?
int main() { int i=-1,j=-1;k=0,l=2,m; m=i++&&j++&&k++||l++; printf("%d%d%d%d%d",i,j,k,l,m); }
Explain do array subscripts always start with zero?