Solace interview question

What is the difference between a memory stack and a memory heap?

Interview Answer

Anonymous

Oct 24, 2017

Stack are objects or variables defined within a scope that will soon be exited, thus inaccessible from elsewhere in the program I.e variables defined inside a loop. The compiler knowsbthis. Heap are objects or variables that you have access to on a larger scale, initialized with the new keyword in c++ if my memory serves me correct, or as static.