C Programming - Memory Allocation - Discussion

Discussion Forum : Memory Allocation - True / False Questions (Q.No. 2)
2.
malloc() allocates memory from the heap and not from the stack.
True
False
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
14 comments Page 1 of 2.

Likita shetty said:   1 decade ago
what is the difference between heap and stack .. i know stack works on the principle of last in first out and what about heap ?

Saurabh said:   1 decade ago
Heap area consist of hash codes .i.e. addreses while stack may or may not be.

Dev. said:   1 decade ago
malloc and calloc allocates memory in heap.

Purva said:   1 decade ago
Like stack is First in first out, how does heap work ?

Reena said:   1 decade ago
The main difference between stack and heap is, Stack is last in first out. But heap is not related to that that concept. Heap is related to dynamic memory allocation. Heap is the area where the elements are stored in a dma. All the malloc() , realloc() and calloc() are related to dynamic memory alloction concepts.

Vaishu said:   1 decade ago
malloc() is dynamic memory allocation. So it is stored in Heep memory.

Mahesh karle said:   1 decade ago
malloc and calloc are always allocates memory in heap.

Amol said:   1 decade ago
What is difference between malloc() & calloc() (4 points)?

JITENDRA KUMAR said:   1 decade ago
malloc takes single argument. But calloc function takes two arguments.
malloc initialize memory chunks with garbage value but calloc initialize with zero.

Both are stored in heap memory and allocate memory at dynamic time.
For security purpose malloc is not prefere than calloc.

Ranjith said:   1 decade ago
What is argument?


Post your comments here:

Your comments will be displayed after verification.