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

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!