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 |
How can I manipulate individual bits?
What is #pragma directive?how it is used in the program? what is its advantages and disadvantages?
write a program to print the all 4digits numbers & whose squares must me even numbers?
What is static volatile in c?
What are the applications of c language?
can we declare a variable in different scopes with different data types? answer in detail
what are two kinds of java
What is a stream in c programming?
What is Memory leakage ?
What is structure of c program?
diff. between *p and **p
What are Storage Classes in C ?
32 Answers CTS, HP, IBM, Maharaja Whiteline, Tamil Nadu Open University TNOU, TATA, TCS, Wipro,