0
typedef struct abc
{
    double a;
    int b;
    char c;
    int d;


}__attribute__((__packed__))abc_t;

int main()
{
    //To do place code
    abc_t tmp;
    printf("The size is %d\n",sizeof(tmp));
    return 0;
}

Since the padding of this structure is disabled, i assume that the size of the structure would be the sum of the sizes of the structure variables which is 8(size of d) + 4(size of b) + 1(size of c) + 4(size of d) equals to 17 but when i run this program the result i am getting is 20. Can some one please explain?

Maddy
  • 503
  • 4
  • 12
  • 21

0 Answers0