When do you use the heap and when do you use the stack?

Technical