Loading...
Loading...
Loading Curriculum...
Loading Subject...
Loading Topic...
Loading Lesson...
Loading Lab...
The return statement terminates function execution and sends a value back to the caller.
int square(int x) {
return x * x;
}int result = square(5); cout << result; // 25
A function can only return ONE value. To return multiple, use pointers, references, structs, or std::pair.
Use return; without a value to exit a void function early.