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.
#include <iostream>
using namespace std;
void doSomething(int&);
int main()
{
int x = 2;
cout << x << endl;
doSomething(x);
cout << x << endl;
return 0;
}
void doSomething(int& num)
{
num = 0;
cout << num << endl;
}