Pages

Showing posts with label How to find number of bytes allocated to structure and union. Show all posts
Showing posts with label How to find number of bytes allocated to structure and union. Show all posts

Sunday, 3 March 2019

Program to find number of bytes allocated to structure and union

Program to find number of bytes allocated to structure and union

#include <stdio.h>
union unionJob
{
   //defining a union
   char name[3];
   float salary;
   int workerNo;
} uJob;

struct structJob
{
   // defining a structure
   char name[3];
   float salary;
   int workerNo;
} sJob;

int main()
{
   printf("size of union = %ld bytes", sizeof(uJob));
   printf("\nsize of structure = %ld bytes", sizeof(sJob));
   return 0;
}

output:


Programs in turboc3 : Files

File Handling in C File Handling concept in C language is used for store a data permanently in computer. Using this concept we can store our...