Again here i am because the course material for C++ was not taught very well at all. The question gives use several function definitions and calls to these functions and expects
Edit: (based on some commenter feedback)
Everything you have is mostly correct, save some confusion on your output values. However, what you have in #4 and #5 is actually not overwritten data, it's actually new data at a new address, which is assigned to the variable i
. This is part of what an earlier commenter said about a potential for a memory leak. Since you're not deleting the old address before assigning a new one, that's where it could occur.
The &*
syntax in the last one is a reference to a pointer. It's essentially the same as int**
except you don't pass &a
as the argument, it's just a
What you have there for number 5 is basically correct, but the reasoning behind it is missing the meaning of &*
You might want to clarify if you've run each of these function calls sequentially or one at a time, since your output is incorrect if you'd indeed run them sequentially as written.