hi,
My question is about the const keyword.
union emp
{
char name[];
int age;
float salary;
};
const union emp e1;
int main()
{
strcpy(e1.name,"H");
printf("%s",e1.name);
e1.age=45;
printf("%d",e1.age);
printf("%f\n",e1.salary);
return 0;
}
I know this code has error which is that "cannot modify constant objects". But Can anyone tell me how can i change the values of a constant union as We can't initalize it while defining union. So what's the way to correct this code snippet ?