Lessons
C++ · Bigger Programs · 25. More About Functions

step 1 of 7

A copy goes in

A function gets a copy of what you give it. doubled changes its copy, but x back in main stays 4.

To keep the answer, catch what comes back.

Mission

Make x itself 8: write x = doubled(x);, then print only x.

PIP·1
main.cppyour code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
← press me!
readyscreen

Press RUN to see what this program does.

Do the mission and Next turns green.

More About Functions