C return Keyword
Example
Return a value from a function:
int myFunction(int x) {
return 5 + x;
}
int main() {
printf("Result is: %d", myFunction(3));
return 0;
}
// Outputs
8 (5 + 3)
Try it Yourself »
Definition and Usage
The return
keyword finishes the execution of a function, and can be used to return a value from a function.
Related Pages
Read more about return values in our C Functions Tutorial.