Morgan Stanley interview question

How to detect where a variable is allocated (HEAP or STACK).

Interview Answer

Anonymous

2 Oct 2014

Value-Typed variables are stored in Stack (int, double, char, ...) whereas Reference-Typed variables (arrays, strings ...) are stored in the Heap.