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 |
Does c have an equivalent to pascals with statement?
What is c language and why we use it?
To print the pattern 1 2 3 4 5 10 17 18 19 6 15 24 25 20 7 14 23 22 21 8 13 12 11 10 9
how to write a prog in c to convert decimal number into binary by using recursen function,
When is a “switch” statement preferable over an “if” statement?
how to find binary of number?
what is pointer
print 1-50 with two loop & two print Statement
What is enumerated data type in c?
What is a node in c?
difference of two no's with out using - operator
What is optimization in c?