ALLInterview.com :: Home Page            
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
Google
   
 
Categories >> Software >> Programming Languages >> C
 
 


 

 
 C interview questions  C Interview Questions (2265)
 C++ interview questions  C++ Interview Questions (1119)
 VC++ interview questions  VC++ Interview Questions (342)
 Delphi interview questions  Delphi Interview Questions (510)
 Programming Languages AllOther interview questions  Programming Languages AllOther Interview Questions (648)
Question
What is the output for the program given below

     typedef enum grade{GOOD,BAD,WORST,}BAD;
     main()
    {
        BAD g1;
        g1=1;
        printf("%d",g1);
     } 
 Question Submitted By :: C
I also faced this Question!!     Answer Posted By  
 
Answer
# 1
1 
Is This Answer Correct ?    9 Yes 0 No
Chris_sreekanth
 
Answer
# 2
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
Ashwin Kumar
 
 
 
Answer
# 3
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
Fefrf
 
Answer
# 4
error 
Is This Answer Correct ?    1 Yes 0 No
Vijay R15
 

 
 
 
Other C Interview Questions
 
  Question Asked @ Answers
 
Write a C program to multiply tho numbers without using arithmetic operator (+, -, *, /).   1
which one is highest Priority in c? a)=,b)+,c)++,d)==   4
What is the difference function call by value & function call by reference?   6
Q. where is the below variables stored ? - volatile, static, register Bosch 3
Can anyone tell what is stack overflow? what precaution we should take?   1
How to write a program to receive an integer & find its octal equivalent by using for loop? google 1
How does C++ help with the tradeoff of safety vs. usability?   1
Is it possible to run using programming C for Java Application? NIC 1
What is the difference between null pointer and the void pointer?   3
how we do lcm of two no using c simple if while or for statement   1
how to find out the union of two character arrays?   2
what are the advantage and disadvantage of recursion   4
 
For more C Interview Questions Click Here 
 
 
 
 
 


   
Copyright Policy  |  Terms of Service  |  Articles  |  Site Map  |  RSS Site Map  |  Contact Us
   
Copyright 2013  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  KalAajKal.com