C Programming - Memory Allocation - Discussion
Discussion Forum : Memory Allocation - General Questions (Q.No. 1)
1.
Which header file should be included to use functions like malloc() and calloc()?
Discussion:
37 comments Page 4 of 4.
Anubhav Singh said:
1 decade ago
we know that stdlib is standard library which include mostly all segments of header files it is like an package, which contains these like alloc.h, malloc.h etc.
Ruthran said:
1 decade ago
stdlib.h header file only have prototype of malloc() and clloc()
Sundar said:
1 decade ago
We can include any of the following header files
1. stdlib.h
2. alloc.h
Since alloc.h is not provided in any option. Therefore stdlib.h is the correct answer.
Hope this help you. Have a nice day!
1. stdlib.h
2. alloc.h
Since alloc.h is not provided in any option. Therefore stdlib.h is the correct answer.
Hope this help you. Have a nice day!
Mahesh said:
1 decade ago
The header file will be alloc.h but it is not in the option.
Likita shetty said:
1 decade ago
I thought its just "alloc.h" .. i remember my program working by using just alloc.h
Wahid sayed said:
1 decade ago
Then when do we use memory.h ?
Janardan said:
1 decade ago
The malloc() and calloc() are two library fuctions to allocate memory in language c. To allocate a block of memory, call malloc & calloc. The prototype for this function is in 'stdlib.h'.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers