We enter the for loop and i has the value 0.
We initialize the 0 with the element of Array to 0.
Then go through the loop again where i has value 1.
And we initialize myArray at 1, to have a value 1.
Though the Array is fully initialized and we have finished our four loop.
Now we've reach the line return myArray, if you wrote this book and code, you were
probably hoping it would copy the array back into for examples Mains Stack frame.
However, that won't work for a variety of reasons, in main, we've only asked for
space to hold a pointer to an end, and not in some array of arbitrary size.
If we wanted an array in mains frame
we would have had to declare an array there and specify its size.
We will see later in the specialization how we can allocate memory
outside of the stack which would persist across function calls, but
we haven't learned how to do that yet.
So when we return myArray,
the value of the expression myArray is a pointer to the first element of the array.
So the return value that you return to call site location one,
is just a pointer to this location.
So when we return, p is going to be assigned to this pointer.
However in the process of returning from this function, that frame goes away.
So now this pointer points over here, where nothing really exists anymore.
We still assign that value to p and
p points right there in memory at whatever happens to be there.
But there's no box associated with that anymore,
it doesn't belong to a particular variable.