c / beginner
Snippet
Returning Values from Functions
Functions can send data back to the part of the program that called them using the 'return' statement. The data type returned must match the type declared in the function signature.
snippet.c
c
1
2
3
int get_status() {return 1;}
Breakdown
1
int get_status() {
Declares a function that is expected to return an integer value.
2
return 1;
Exits the function and sends the value 1 back to the caller.