+ 5
Why malloc() allocates memory from heap not from stack?How?
2 ответов
+ 3
Stack memory is occupied with function calls. It might be difficult to allocate memory from stack
+ 2
The stack is very limited in comparison to the heap. And allocating memory from the stack means a danger of stack-overflow, and the possibility to execute shellcodes easier.