Program to Calculate Size of Structure


#include<stdio.h>
#include<conio.h>

struct my_structure
{
 int a,b,c;                            //size: 3*2=6
 float f;                               //size: 1*4=4
 char i,j,l;                           //size: 3*1=3
 int array[10];                    //size: 10*2=20
}
ms1;

main()
{
 int size;
 clrscr();

 size=sizeof(ms1);           // Total size: 33
 printf("The size of My Structure is %d",size);

 getch();
}

0 comments:

Post a Comment