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 |
Bit swapping
Explain About fork()?
how to find the largest element of array without using relational operater?
Explain that why C is procedural?
main() { char *p; p="Hello"; printf("%c\n",*&*p); }
What is include directive in c?
The file stdio.h, what does it contain?
How many parameters should a function have?
What are static functions?
What is the difference between printf and scanf in c?
write a program that finds the factorial of a number using recursion?
what type of questions arrive in interview over c programming?