To find size of a structure. We can use a pointer as we know if we increment structure pointer by one it will incremented by size of that structure, see below.
struct find_size{
int num;
char chr;
};
int main()
{
int size_of_structure = 0;
struct find_size *a = 0;
size_of_structure = ((char *)(a + 1)) – ((char *)a);
printf(“size_of_structure = %d\n”,size_of_structure);
return 0;
}