×

Loading...

1,3 are correct but 2 is wrong.

In 1), 3) the address of somewhere in the static data area will be returned.
But in 2), p is the address of the array, which is allocated on the stack and in one stack frame. After the function 'v()' is returned the stack frame
is removed (or become invalid), thus the address of the array (i.e. 'p') becomes an invalid address.
Report

Replies, comments and Discussions: