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

Simple Function Return

easyFunctions

📄 Code

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

🎯 Your Answer