C – Find size of Structure

Program to find the size (memory allocated to structure): sizeof() functions returns the total number bytes allocated to structure.

struct Emp
            int id;
            char name[20];
            float salary;     
int main()
            struct Emp x;
            printf(“size of Emp : %d \n”, sizeof(x));
            printf(“size of Emp : %d \n”, sizeof(struct Emp));
            return 0;          
Scroll to Top