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 |
what is associativity explain what is the precidence for * and & , * and ++ how the folloing declaration work 1) *&p; 2) *p++;
number of times a digit is present in a number
c programming of binary addition of two binary numbers
Explain spaghetti programming?
dennis ritchie invented C language in AT&T bell laboratory what is the extension of AT&T?
Explain the importance and use of each component of this string: Foo.Bar, Version=2.0.205.0, Culture=neutral, PublicKeyToken=593777ae2d274679d
What is an lvalue and an rvalue?
what is the diff between the printf and sprintf functions?? and what is the syntax for this two functions ??
any function have arguments one or more OR not . it is compulsary a) any function compulsary have one or more arguments b) any function did not have arguments. It is not compulsary c) it is optional it is not compulsary d) none of the above
main() { int x=2, y=4 if ((x==2||y==4) x++ y++ if (y==4+1) { x=x+y; } y++; printf("The values of x and y are %d and %d."x,y); } What is the output?
What is the difference between class and object in c?
what is the difference between exit() and _exit() functions?