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
How can I manipulate individual bits?
Who developed c language?
Why do we use c for the speed of light?
What are the types of pointers?
What are keywords in c with examples?
What are the advantages of Macro over function?
Program to find the sum of digits of a given number until the sum becomes a single digit. (e.g. 12345=>1+2+3+4+5=15=>1+5=6)
What is difference between array and pointer in c?
What is volatile, register definition in C
Explain union. What are its advantages?
Explain how many levels deep can include files be nested?
Write a program to swap two numbers without using third variable in c?
Explain how do you declare an array that will hold more than 64kb of data?
Explain what is the benefit of using an enum rather than a #define constant?
What is the significance of an algorithm to C programming?