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 |
Explain the priority queues?
What is New modifiers?
What is use of pointer?
What is the size of array float a(10)?
How to delete a node from linked list w/o using collectons?
write a own function to compare two strings with out using stringcomparition function?
What is getch?
Are global variables static in c?
how to solve "unable to open stdio.h and conio.h header files in windows 7 by using Dos-box software
What is putchar() function?
write a program to gat the digt sum of a number (et. 15= >1+5=6)
What should malloc(0) do?