Question: Question 1 Consider the given Program A and Program B. Answer all the five questions based on these two program. struct actor { struct actor

 Question 1 Consider the given Program A and Program B. Answerall the five questions based on these two program. struct actor {struct actor { char name[32]; struct actor "next char "name }"head =NULL; char *get name() struct actor "next }"head = NULL; char *getname() char *q, q (char *) malloc(32); printf("Please enter a name: ");

Question 1 Consider the given Program A and Program B. Answer all the five questions based on these two program. struct actor { struct actor { char name[32]; struct actor "next char "name }"head = NULL; char *get name() struct actor "next }"head = NULL; char *get name() char *q, q (char *) malloc(32); printf("Please enter a name: "); scanf("%s", q): return q; char *q, q = (char *) malloc(32); printf("Please enter a name: "); scanf("%s", q): return q; int insertion() (struct actor *c; char *n; int insertion() {struct actor *c; char *n; c malloc(sizeof(struct actor); c malloc(sizeof(struct actor)); if (c == 0) { printf("out of memoryln"); return -1;] n = get-name(); strcpy(c-name, n); free(n); c->next head; head c; return 1 printf("out of memoryln"); return -1;] c->name get name): c->next-head; head c; return 1 Which piece of code has memory leak? a. Neither Program A nor Program B b. Both Program A and Program B O C. Program A o d. Program B Question 1 Consider the given Program A and Program B. Answer all the five questions based on these two program. struct actor { struct actor { char name[32]; struct actor "next char "name }"head = NULL; char *get name() struct actor "next }"head = NULL; char *get name() char *q, q (char *) malloc(32); printf("Please enter a name: "); scanf("%s", q): return q; char *q, q = (char *) malloc(32); printf("Please enter a name: "); scanf("%s", q): return q; int insertion() (struct actor *c; char *n; int insertion() {struct actor *c; char *n; c malloc(sizeof(struct actor); c malloc(sizeof(struct actor)); if (c == 0) { printf("out of memoryln"); return -1;] n = get-name(); strcpy(c-name, n); free(n); c->next head; head c; return 1 printf("out of memoryln"); return -1;] c->name get name): c->next-head; head c; return 1 Which piece of code has memory leak? a. Neither Program A nor Program B b. Both Program A and Program B O C. Program A o d. Program B

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!