Size of a structure with interleaved members

On a 64-bit Linux platform where char, int and double occupy 1, 4 and 8 bytes and each is aligned to its own size, what does sizeof(struct mixed) evaluate to for the declaration below? Give the answer in bytes as a whole number.


C
struct mixed {
    char   a;
    double b;
    char   c;
    int    d;
};

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

More Structure Types Questions: