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
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 |
Answer / modassir alam
TWO or any enum variable not hold memory address hence error
Is This Answer Correct ? | 2 Yes | 1 No |
What is difference between class and structure?
What does 2n 4c mean?
What is the difference between null pointer and the void pointer?
Explain what is the general form of a c program?
What is the ANSI C Standard?
Explain can static variables be declared in a header file?
What is masking?
how can i get output like this? 1 2 3 4 5 6
What is void pointers in c?
why integer range between -327680to+32767
Dont ansi function prototypes render lint obsolete?
What does s c mean in text?