Â
#include <stdio.h>
union test
{
int x, y;
};
int main()
{
union test t;
t.x = 2; // t.y also gets value 2
printf(" x = %d, y = %d\n\n", t.x, t.y);
t.y = 10; // t.x is also updated to 10
printf(" x = %d, y = %d\n\n", t.x, t.y);
return 0;
}
//.........Coded by ARADHANA MISHRA
#ENJOY CODING
Post a Comment
FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP