The correct answer is actually 2 0 0.
I understand why 2 is the answer but i dont understand the 0 0. Can someone please explain it? Im ready to pull my hair out.
Pass by reference ...
cout x, its 2, ok.
call dosomething. Num is now x. Its the same thing.
change num to 0. This changes x to 0, because num = x because num is a reference to x.
cout num, which is x, which is zero.
exit function.
cout x, which is 0, again.