I need an explanation of the below code example regarding why its size is calculated as 32. As per my calculation and output that I get it comes as 28 , shown as follows :
size of price : 8 + size of title: 8 + size of author : 8 + size of number_pages : 4 Hence total : 8+8+8+4 = 28
Below is the code:
#include <stdio.h>  
struct store  
{  
    double price;  
    union  
    {  
        struct{  
        char *title;  
        char *author;  
        int number_pages;  
        } book;  
      
        struct {  
        int color;  
        int size;  
        char *design;  
        } shirt;  
    }item;  
};  
  int main()  
{  
    struct store s;  
    s.item.book.title = "C programming";   
    s.item.book.author = "John";  
    s.item.book.number_pages = 189;  
    printf("Size is %ld", sizeof(s));  
    printf("\nPrinting size of each items\n"); 
    print ("size of price = %ld\n", sizeof(s.price));
    print ("size of title = %ld\n", sizeof(s.item.book.title));
    print ("size of author = %ld\n", sizeof(s.item.book.author));
    print ("size of number_pages = %ld\n", sizeof(s.item.book.number_pages));
    return 0;  
}  
Am I making any mistake ? Any explanation will be great!
Thanks
