CJCoding With Joseph
15per day
← Back to Question List
C++ Code Walkthrough #1

Reference vs Value Parameter

mediumFunctions

📄 Code

Read carefully — what does this print?
1#include <iostream>
2using namespace std;
3 
4void modify(int a, int &b) {
5 a = a + 10;
6 b = b + 10;
7}
8 
9int main() {
10 int x = 5, y = 5;
11 modify(x, y);
12 cout << x << " " << y << endl;
13 return 0;
14}

🎯 Your Answer

Next →