Which standard C header must be included to use malloc(), calloc() and free()?
Correct answer
B. <stdlib.h>
13 views
B. <stdlib.h>
13 views
malloc, calloc, realloc and free are declared in , the general-utilities header that also holds atoi, rand and exit. declares console and file I/O such as printf and fopen, while holds strcpy and memset. Mixing these up is a common compile-time trap: calling malloc without its declaration produces an implicit-declaration warning or error.
Asked in: NTS, PPSC IT, Campus Interviews
Not sure why the answer is B? Ask here and get an explanation.