Question: ` ` ` Program A struct actor { char name [ 3 2 ] ; struct actor * next; } * head = NULL; char

```
Program A
struct actor {
char name[32];
struct actor *next;
}*head = NULL;
char *get_name()
{ char *q;
q =(char *) malloc(32);
printf("Please enter a name: ");
scanf("%s", q); return q;
};
int insertion()
{struct actor *c; char *n;
c = malloc(sizeof(struct actor));
if (c ==0){
printf("out of memory
"); return -1;}
n = get_name();
strcpy(c->name, n);
c->next = head;
head = c;
return 1
};
```
```
Program B
struct actor {
char *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;
};
int insertion()
{struct actor *c; char *n;
c = malloc(sizeof(struct actor));
if (c==0){
printf("out of memory
"); return -1;}
c->name = get_name();
c->next = head;
head = c;
return 1
};
```
Where should the memory be freed?
In insertion() function in Program B
In get_name() function in Program B
In get_name() function in Program A
In insertion() function in Program A
` ` ` Program A struct actor { char name [ 3 2 ]

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 Programming Questions!