Declaring values to Union || Unions || C programming
In this, we are going to Declare values to Union using Unions with help of C Programming Language.

 

#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

Previous Post Next Post