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.
This post has been archived. It cannot be replied.