|
|
|
|
|
by sh_vipin
4916 days ago
|
|
1. Most of the compilers restrict the size of Stack to be much less than the size of heap. 2. If you use the space of this stack for dynamic memory allocation as well, you will be limiting your capacity to write recursive functions. 3. it will depend on the kind of system you are developing. If you are developing some tool to analyze millions of tweets, you have to use "heap" there is no alternate. If you are developing an embedded application " say loading your list of conatcts for sending the message yes there you can get away with allocating the memory on stack itself. But then there most of the phones do not allow you to make a list of more than 25-30 people. So it depends on the application one is willing to develop and K&R well recognized it in early 70s itself that is why they introduced alloca in addition to malloc , calloc -http://syncfin.com |
|