We already discussed how to return values from functions but what happens when we return an address?
Depends. This video illustrates the wrong thing to do, which is returning the address of a local variable in the function.
Video Duration - 13"02 / Development Environment - Windows / JGrasp / MinGW
So when is it alright to return an address? Anytime you return the address of something which is not going
to "disappear" when the function returns; e.g. a dynamically allocated memory block.
Video Duration - 05"20 / Development Environment - Windows / JGrasp / MinGW
Let us take another look at the two previous programs and trace them with a stack diagram to make sure we figure
out what is exactly happening under the hood.
Video Duration - 05"32 / Development Environment - Windows / JGrasp / MinGW