A question I have on Problem 3.44 of the book *Computer Systems: A Programmer's Perspective* (3rd edition (6 October 2015)) on data alignment.

The problem:

> 
> For each of the following structure declarations, determine the offset of each feild, the total size of the structure, for 8-bit alignment:
> 
> 
> 

```c
struct P1 {short i; int c; int *j; short *d}
...
struct P4 {char w[16]; char *c[2]}
struct P5 {struct P4 a[2]; struct P1 t}

```

Answer given in the book:

* struct P1:

| i | c | j | d | total |
| --- | --- | --- | --- | --- |
| 0 | 2 | 6 | 14 | 16 |

* struct P4:

| w | c | total |
| --- | --- | --- |
| 0 | 16 | 32 |

* struct P5:

| a | t | total |
| --- | --- | --- |
| 0 | 24 | 40 |

What I don't get is why did `struct P4 a[2]` in `P5` only takes 24 bytes?  

Since `P5.a` is an array of `P4` of size 2, shouldn't it occupy `2 * 32 (total size of P4)` bytes?

---

To make sure I quote the book correctly, attaching the screenshots below:
[![enter image description here](https://i.stack.imgur.com/8WNmu.jpg)](https://i.stack.imgur.com/8WNmu.jpg)
[![enter image description here](https://i.stack.imgur.com/bRx2w.jpg)](https://i.stack.imgur.com/bRx2w.jpg)