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 |
Define function pointers?
Why are some ANSI/ISO Standard library routines showing up as undefined, even though I've got an ANSI compiler?
WAP to accept first name,middle name & last name of a student display its initials?
wats SIZE_T meant for?
what are the different storage classes in c?
1.What is a Data Structure? Explain its need? 2.What is a Directed Graph? Write an algorithm to find whether a Directed Graph is connected or not? 3.Explain the process of converting a Tree to a Binary Tree.
What is the function of volatile in c language?
What are the types of variables in c?
how to copy a string without using c function
WHAT IS HEADER?
Explain how do you list a file’s date and time?
What is the difference between typeof(foo) and myFoo.GetType()?