#include<stdio.h>
typedef enum {a,b,c}key;
int main()
{
key d=3;
printf("%p\n,&a);
printf("%p\n",&d);
printf("%d\t %d\t %d\t %d\n",a,b,c,d);
return 0;
}
When I try to get the address of either a or b or c
Compiler throws an error that lvalue required for unary &
I didn’t get it because it’s working for d of same type.
What’s happening here ? are these constants or the const varibales assigned with values 0 1 and 2 by the compiler.
Beacause this kind of error we got for constants only.
Please help , I am new to C
a,b,c are symbols for constant-integers within an enum. They’re not variables to have an address. Hence & cannot be used here(which means only rvalue).