Question: Assume that the structs are the same as the ones from the lab on authors and books. Does the following segment of code have any
Assume that the structs are the same as the ones from the lab on authors and books. Does the following segment of code have any memory violations?
1: bookArr[i].authors = (author_t* ) calloc(bookArr[i].numAuthors, sizeof(author_t)) 2: for (int j = 0; j < bookArr[i].numAuthors; j++) { 3: scanf("%s", bookArr[i].authors[j].name) 4: scanf("%d", &bookArr[i].authors[j].birthYear); 5: scanf("%d", &bookArr[i].authors[j].publishings) 6: } Please answer only in Yes or no.
Yes
or
No
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
