Page

Example of Unions in C Language

#include <stdio.h>
#include <conio.h>
union emp {        
   char name[32];
   float salary;
   int worker_no;
}u;
struct emp1 {
   char name[32];
   float salary;
   int worker_no;
}s;
int main(){
   printf("size of union = %d",sizeof(u));
   printf("\nsize of structure = %d", sizeof(s));
   return 0;

No comments:

Post a Comment