C Program to Find Size of Structure Without Using sizeof Operator

Here is the C program to find the size of structure without using the ‘sizeof’ operator. It is the most repeated one among C interview questions to find the size of the structure in C without the use of sizeof operator.

C Program to Find Size of Structure Without Using sizeof Operator

Program:

struct mystruct{
 int a;
 float b;
 char c;
};
int main(){
 struct mystruct *ptr=(struct mystrcut *)0;
 ptr++;
 printf("Size of structure is: %d",*ptr);
 return 0;
}