How to find the size of the Structure without using sizeof() operator in C

#include<stdio.h>

struct sample{
       int num;
       char addr;
       float val;
};
int main(){
       struct sample *ptr = 0;
       ptr++;
       printf("Size of the structure sample: %d",ptr);
       return 0;

}
OUTPUT:
Size of the structure sample: 9

No comments:

Post a Comment