Question: Which code fragment shall justifiably use malloc()? In other words, which malloc() cannot be replaced with static allocation? int *data; data = malloc (sizeof
Which code fragment shall justifiably use malloc()? In other words, which malloc() cannot be replaced with static allocation? int *data; data = malloc (sizeof (int) * 100); struct sigaction *sa; sa malloc (sizeof(struct sigaction)); char *s; s malloc (sizeof (char)); int size, *array; fscanf (stdin, "%d", &size); array malloc(size*sizeof (int)); Which code fragment shall justifiably use malloc()? In other words, which malloc() cannot be replaced with static allocation? int *data; data = malloc (sizeof (int) * 100); struct sigaction *sa; sa malloc (sizeof(struct sigaction)); char *s; s malloc(sizeof (char)); int size, *array; fscanf (stdin, "%d", &size); array malloc (size* sizeof (int));
Step by Step Solution
There are 3 Steps involved in it
The detailed answer for the above question is provided below The correct code fragment should typically use malloc in other words which malloc cannot be replaced with static allocation The correct ans... View full answer
Get step-by-step solutions from verified subject matter experts
