Question: malloc and calloc return pointers to the heap, of type void * . Why don't they return the type that you requested? A: They can't,
malloc and calloc return pointers to the heap, of type void Why don't they return the type that you requested?
A: They can't, since C does not have support for functions that return multiple different types.
B: They could, but they don't for performance reasons.
C: They can't, since there's no way to return pointers to functions, and you might want to allocate a function.
D: They could, but it would make the API more awkward since you would have to pass the desired type as a parameter.
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
