In which all situations is it better to store data in the heap instead of the stack?
Till now, I haven't seen any situation in which the heap is absolutely necessary in languages like C; I haven't come across any code that takes a large amount of data, so large that it needs the heap too to hold the data. Apart from dynamic arrays, where else is it used? I usually make a large-sized array in the stack instead of making a dynamic one in the heap; my justification is that the heap is very slow as compared to the stack. Am I following the right practice? Thank you.