I am trying to understand the effects of following function:
This is just an example of the function...there is not much body of the function given. We just have to justify our answer. I am clueless on how to resolve this. Any help would be appreciated.
Int1 and int2 are local variables of the function. What this function will return is a reference to int1. However, this is a problem because once the function returns, it is removed from the stack and all local variables (such as int1) of the function are "deleted". Thus, the function ends up returning a reference to a non-existing int.