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
 
control 50 devices which has 2 states on and off.using bitwise operator.plz answer it its urgent   1
Implement a function that returns the 5th element from the end in a singly linked list of integers in one pass. Microsoft 11
Write a program for the following series? 1 121 12321 1234321 123454321 12345654321 1234567654321 123456787654321 12345678987654321 1234567890987654321 123456789010987654321 12345678901210987654321 1234567890123210987654321 .........1234321............ ..........123454321............ ..........12345654321............ 7 8 9 0 1 Pls............?   5
progrem to generate the following series 1 12 123 1234 12345 HCL 5
What is macro? IBM 5
what does data structure mean?   8
who is the founder of c HP 19
3. Program to print all possible substrings. ex: String S St Str Stri Strin String t tr tri trin tring r Huawei 3
m=++i&&++j(||)k++ printf("%d"i,j,k,m) ABC 1
why i join syntel? Syntel 22
How to run c Program without using IDE of c. means if program made in notepad.then how to compile by command prompt. TCS 1
#include<stdio.h> int main() { int i=0,j=1,k=2,m,n=0; m=i++&&j++&&k++||n++; printf("%d,%d,%d,%d,%d",i,j,k,m,n); } Capital-IQ 12
 
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