Skip to content

Commit

Permalink
added uninon
Browse files Browse the repository at this point in the history
  • Loading branch information
adithyaanilkumar committed Jun 29, 2020
1 parent 5752e6a commit b52b74e
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions C/uninon.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
//sizeof() an union example

#include<stdio.h>
void main()
{
int a;
float b;
struct student_details
{
char name[20];
int regno;
}student;

union code
{
int x;
char c;
float y;
}sample;

printf("size of variable a=%d\n",sizeof(a));
printf("size of variable b=%d\n",sizeof(b));
printf("size of structure variable is %d\n",sizeof(student));
printf("size of union variable is %d\n",sizeof(sample));
printf("size of integer is %d\n",sizeof(int));

}

0 comments on commit b52b74e

Please sign in to comment.