Introduction to Unions in c++




This video tutorial introduces you to the unions in c++.
You are gonna learn what is a union, how to declare or define a union, how values are stored in unions,how to access the unions in detail with examples.

watch the video on difference between structure and unions at

















source code for this tutorial

#include <iostream>

using namespace std;

union emp{
 int id;
 float sal;
}anil,ras;

int main()
{
emp anjali;

anjali.id = 25;

cout << anjali.id;


    return 0;
}