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.
Saddam said:
9 years ago
According to me malloc() and calloc() is dynamic memory allocation.
Ashwini said:
9 years ago
Hi, friends.
What is brk & sys_brk? Please explain briefly.
What is brk & sys_brk? Please explain briefly.
Vishalakshi said:
9 years ago
I think malloc is better than calloc. Because calloc initialize all its elements to be zero, when memory is allocated. so when you want to insert '0' value in that memory location ,if you want to count the how many times '0' is repeated ,it counts all initialized value and inserted value. so it gives unexpected result.
So malloc is better.
So malloc is better.
Mohan rsm said:
8 years 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'.
Suresh said:
8 years ago
What is the stdib header file can you explain this?
Vicky Karn said:
8 years ago
malloc(), calloc(), realloc() n free(), all are defined in stdlib.h as well as alloc.h
We can include anyone.
Regarding option, stdlib.h is the answer.
We can include anyone.
Regarding option, stdlib.h is the answer.
(1)
Harsh said:
7 years ago
Basically, stdlib.h is a standard C header that includes malloc and calloc and free as well.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers