Thursday 2 July 2020

CPP Program to implement union

Source Code : 

#include<iostream>
#include<stdio.h>
using namespace std;
union test
{
int x;
char y[5];
int z;
}t1;
int main()
{
cout<<"Size = "<<sizeof(t1);
return 0;
}

Program Output : 


CPP Program to find out the output of i and i++ with input zero

Source Code : 

#include<iostream>
#include<stdio.h>
using namespace std;
int main()
{
int i = 0;
cout<<i<<" , "<<i++;
return 0;
}

Program Output :