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'.
Wahid Sayed said:
(Wed, Oct 20, 2010 12:55:00 PM)
Then when do we use memory.h ?
Likita Shetty said:
(Fri, Jan 7, 2011 09:10:12 AM)
I thought its just "alloc.h" .. i remember my program working by using just alloc.h
Mahesh said:
(Fri, Jan 21, 2011 12:39:36 PM)
The header file will be alloc.h but it is not in the option.
Sundar said:
(Fri, Jan 21, 2011 11:27:46 PM)
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!
Ruthran said:
(Tue, Mar 1, 2011 05:37:06 AM)
stdlib.h header file only have prototype of malloc() and clloc()
Anubhav Singh said:
(Sun, Jun 19, 2011 12:59:50 AM)
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.
Both allocate storage memory but the difference is malloc process single argument so just specify storage space while calloc process double argument so specify no. Of variable and space needed for that variable.