why it is necessary to use heap for local variable? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

why it is necessary to use heap for local variable?

we know stack is for local variable then why we use heap

13th Oct 2016, 11:18 PM
Rashid Mujahid
Rashid Mujahid - avatar
1 Answer
+ 1
1. Stack size limit depends on OS, not on available memory (this can be an issue sometimes). 2. You cannot change a size of variable hold in Stack (you cannot realloc() your variable)
14th Oct 2016, 12:04 AM
dasdd adas
dasdd adas - avatar