Why the below program throughs error during compilation?

#include<stdio.h>
#include<conio.h>
enum
{
ZERO,
ONE,
TWO,
};

main()
{

printf("%d",&TWO);
getch();
}

Answers were Sorted based on User's Feedback



Why the below program throughs error during compilation? #include<stdio.h> #include<con..

Answer / vadivelt

Since memory shall not be allocated for an enum variable,
accessing address of the same is not possible.

ie.,
Below line is invalid, cos u r trying to access the address
of a constant.

printf("%d",&TWO);

Hence the error.

Is This Answer Correct ?    6 Yes 0 No

Why the below program throughs error during compilation? #include<stdio.h> #include<con..

Answer / modassir alam

TWO or any enum variable not hold memory address hence error

Is This Answer Correct ?    2 Yes 1 No

Post New Answer

More C Interview Questions

What is difference between class and structure?

0 Answers  


What does 2n 4c mean?

0 Answers  


What is the difference between null pointer and the void pointer?

3 Answers  


Explain what is the general form of a c program?

0 Answers  


What is the ANSI C Standard?

0 Answers   Celstream,






Explain can static variables be declared in a header file?

0 Answers  


What is masking?

0 Answers  


how can i get output like this? 1 2 3 4 5 6

6 Answers   Excel,


What is void pointers in c?

0 Answers  


why integer range between -327680to+32767

2 Answers  


Dont ansi function prototypes render lint obsolete?

0 Answers  


What does s c mean in text?

0 Answers  


Categories