Question: Please Answer All Questions Correctly For Upvote Memory leak detection exercise Program B struct actor 4. Where should the actor object linked to c be

Please Answer All Questions Correctly For Upvote

Please Answer All Questions Correctly For Upvote Memory leak detection exercise Program

Memory leak detection exercise Program B struct actor 4. Where should the actor object linked to c be 1.Which piece of code struct actor has memory lca a Neither A nor B b) Both A and B c) A char name 32]; char *name; struct actor *next; } *head NULL; struct actor *next; 'eed: } *head NULL; a) In get name) in A b) In insertion0 in A char *get_name() f char *q; char *get_name() c) In main) function { char *q; d) In deletion() function 2. Which piece of memory is leaked? q = (char *) malloc(32); printf("Please enter a name: "); scanf("%s", q): return q; malloc(32) in A b) malloc(32) in B c) char name 32] in A d) char name[32] in B q (char *) malloc(32); printf("Please enter a name: "); scanf("%s", q): return q; a) int insertion() { actor "c; char *r; int insertion() { actor *c; char *n; malloc(sizeof(struct actor)); if(c== 0) { c malloc(sizeof(struct actor)); if(c== 0) { Antcomelre printf("out of memoryln"); return -1;) n = get-name(); strcpy(c->name, n); free(n) memory be freed? c->next head; head-c return 1 printf( out of memoryln"); return -1;) c->name = get-name(); c->next = head head = c return 1 3. Where should the 5. When vou write the delction function for A & B how many free0 calls are required? Select all that apply. I One for Program A [ ] Two for Program A [ ] One for Program B I] Two for Program B a) In get-name() in A b) In get name0 in B c) In insertion0 in A !; d) In insertion() in B CSE240 Please take online test after the lecture! /23/2017

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!