Why the below program throughs error during compilation?
#include<stdio.h>
#include<conio.h>
enum
{
ZERO,
ONE,
TWO,
};
main()
{
printf("%d",&TWO);
getch();
}
Answer Posted / 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 |
Post New Answer View All Answers
what will be the output for the following main() { printf("hi" "hello"); }
Why do we use & in c?
What is difference between && and & in c?
What is context in c?
What is the ANSI C Standard?
What is the deal on sprintf_s return value?
What is string constants?
What is the method to save data in stack data structure type?
Can you write the function prototype, definition and mention the other requirements.
Explain what are the different file extensions involved when programming in c?
Explain the difference between #include "..." And #include <...> In c?
What does != Mean in c?
Is it better to use malloc() or calloc()?
What are the types of pointers in c?
Explain what is wrong in this statement?