CJCoding With Joseph
15free / daySign inCreate account
Back to Code Walkthrough

Simple Function Return

C++ code walkthrough · Question 15
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