Which header file should be included to use functions like malloc ( ) and colloc( )

This question was previously asked in
ESE Mechanical 2014 Official Paper - 2
View all UPSC IES Papers >
  1. dos.h
  2. stdlib.h
  3. memory.h
  4. string.h

Answer (Detailed Solution Below)

Option 2 : stdlib.h
Free
ST 1: UPSC ESE (IES) Civil - Building Materials
6.2 K Users
20 Questions 40 Marks 24 Mins

Detailed Solution

Download Solution PDF

Concept:

In C, you should include stdlib.h.

This will give you the function prototypes for the family of malloc functions (malloc, calloc, realloc, and free).

Some compiler vendors provide access to these functions through other header files as well, but stdlib.h is the most portable one to use.

Latest UPSC IES Updates

Last updated on May 28, 2025

->  UPSC ESE admit card 2025 for the prelims exam has been released. 

-> The UPSC IES Prelims 2025 will be held on 8th June 2025.

-> The selection process includes a Prelims and a Mains Examination, followed by a Personality Test/Interview.

-> Candidates should attempt the UPSC IES mock tests to increase their efficiency. The UPSC IES previous year papers can be downloaded here.

Get Free Access Now
Hot Links: teen patti cash teen patti wala game teen patti gold old version teen patti yes