K
kris
Hi I am writing a small program where I need to obtain the actual size
of a structure.
The programm is as follows
struct abc
{
int j;
char k;
int i;
}*a;
main()
{
a->j=10;
printf("size of structure is %d",sizeof(a));
}
In this program when I print the size of structure I get the whole
size (i.e size of 2 int variables+size of char variable).
But I need to get the size of structure such that it resembles the
chunk of memory that is actually being used.
Thanks
Krish
of a structure.
The programm is as follows
struct abc
{
int j;
char k;
int i;
}*a;
main()
{
a->j=10;
printf("size of structure is %d",sizeof(a));
}
In this program when I print the size of structure I get the whole
size (i.e size of 2 int variables+size of char variable).
But I need to get the size of structure such that it resembles the
chunk of memory that is actually being used.
Thanks
Krish