Question: ` ` ` Program A struct actor { char name [ 3 2 ] ; struct actor * next; } * head = NULL; char
Program A
struct actor
char name;
struct actor next;
head NULL;
char getname
char q;
q char malloc;
printfPlease enter a name: ;
scanfs q; return q;
;
int insertion
struct actor c; char n;
c mallocsizeofstruct actor;
if c
printfout of memory
; return ;
n getname;
strcpycname, n;
cnext head;
head c;
return
;
Program B
struct actor
char name;
struct actor next;
head NULL;
char getname
char q;
q char malloc;
printfPlease enter a name: ;
scanfs q; return q;
;
int insertion
struct actor c; char n;
c mallocsizeofstruct actor;
if c
printfout of memory
; return ;
cname getname;
cnext head;
head c;
return
;
Where should the memory be freed?
In insertion function in Program B
In getname function in Program B
In getname function in Program A
In insertion function in Program A
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
