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.5 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 Jul 2, 2025

-> ESE Mains 2025 exam date has been released. As per the schedule, UPSC IES Mains exam 2025 will be conducted on August 10. 

-> UPSC ESE result 2025 has been released. Candidates can download the ESE prelims result PDF from here.

->  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 royal teen patti rules teen patti 51 bonus rummy teen patti teen patti dhani