Question: typedef struct Bcck {char name[50]; int volume;} Book; typedef struct Shelf {int numberOfBooks; Book books[15];} Shelf; Shelf bookShelf[8]; Shelf* bockShelf = malloc (sizeof (Shelf) *8);
![typedef struct Bcck {char name[50]; int volume;} Book; typedef struct Shelf](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f96828dd6d5_16066f9682860925.jpg)
typedef struct Bcck {char name[50]; int volume;} Book; typedef struct Shelf {int numberOfBooks; Book books[15];} Shelf; Shelf bookShelf[8]; Shelf* bockShelf = malloc (sizeof (Shelf) *8); Shelf bockShelf = malloc(sizeof(Shelf)*8); Shelf* bookshelf = malloc((sizeof(int) + sizeof(Book)*15)*8); Shelf* bookshelf = malloc((sizeof(int) + sizeof(Book*)*15)*3); Dynamically allocating memory to store a bookshelf containing 8 shelves is correctly done by: 2 and 4 2 only 2 and 5 3 and 5 1 and 4
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
