Pergunta de entrevista da empresa Zywave

When do you declare a variable on the stack, and when do you declare it on the heap?