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
Explain the difference between structs and unions in c?
main() { printf("hello"); fork(); }
When can you use a pointer with a function?
How can I run c program?
How the c program is executed?
What is struct node in c?
Explain why can’t constant values be used to define an array’s initial size?
What is null character in c?
What is the difference between int main and void main in c?
What are the keywords in c?
How do you define a string?
Stimulate calculator using Switch-case-default statement for two numbers
Is null always equal to 0(zero)?
Explain about the functions strcat() and strcmp()?
In C programming, how do you insert quote characters (‘ and “) into the output screen?