Intel Corporation interview question

When it is better to use stack variable instead of heap variable?