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



What is the output for the program given below typedef enum grade{GOOD,BAD,WORST,}BAD; ..

Answer / chris_sreekanth

1

Is This Answer Correct ?    9 Yes 0 No

What is the output for the program given below typedef enum grade{GOOD,BAD,WORST,}BAD; ..

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

What is the output for the program given below typedef enum grade{GOOD,BAD,WORST,}BAD; ..

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 the output for the program given below typedef enum grade{GOOD,BAD,WORST,}BAD; ..

Answer / vijay r15

error

Is This Answer Correct ?    1 Yes 0 No

Post New Answer



More C Interview Questions

Write a C program where input is: "My name is xyz". output is: "xyz is name My".

1 Answers   TCS,


a single linked list consists of nodes a to z .print the nodes in reverse order from z to a using recursion

0 Answers   Mindteck,


how to print this sereis 2 4 3 6 5..........?

3 Answers  


Write a c program using for loop to print typical pattern if number of rows is entered by keyboard. ABCBA AB BA A A

1 Answers  


Write an interactive c program that will encode or decode a line of text. To encode a line of text, proceed as follows: Convert each character, including blank spaces, to its ASCII equivalent. Generate a positive random integer. Add this integer to the ASCII equivalent of each character. The same random integer will be used for the entire line of text. Suppose that N1 represents the lowest permissible value in the ASCII code, and N2 represents the highest permissible value. If the number obtained in step 2 above exceeds N2, then subtract the largest possible multiple of N2 from this number, and add the remainder to N1. Hence the encoded number will always fall between N1 and N2, and will therefore always represent some ASCII character. Display the characters that correspond to the encoded ASCII values. The procedure is reversed when decoding a line of text. Be certain, however, that the same random number is used in decoding as was used in encoding.

1 Answers   TCS, HCL, Wipro, Amazon, Microsoft, CSJM,






where does malloc() function get the memory?

1 Answers  


in which language c language is written?

2 Answers  


c pgm count no of lines , blanks, tabs in a para(File concept)

2 Answers  


Explain what?s happening in the first constructor: public class c{ public c(string a) : this() {;}; public c() {;} } How is this construct useful?

1 Answers  


write a program in c language that uses function to locate and return the smallest and largest integers in an array,number and their position in the array. it should also find and return the range of the numbers , that is , the difference between the largest number and the smallest.

1 Answers  


WAP to find that given no is small or capital

3 Answers  


Expand the following LKB BKL FFG

0 Answers  






Categories