Checkpoint 8.6.1.
What will print?
int addTwo(int x) {
cout << x << " ";
x = x + 2;
cout << x << " ";
return x;
}
int main() {
int num = 2;
addTwo(num);
cout << num << endl;
}
2 4
- Take a look at exactly what is being outputted.
2 4 2
- Correct!
4 4 2
- Take a look at exactly what is being outputted.
2 4 4
- Remember the rules of pass by value.