About Lesson
Functions can return a value to the calling code using the return
statement. The return type is specified in the function signature.
// Function declaration with return type
int square(int x);
// Function definition with return statement
int square(int x) {
return x * x;
}
// Calling the function and using the returned value
int result = square(5);
Â
Join the conversation