Return Statement in C
The return statement in C is used to terminate the execution of a function and return a value to the caller. It is commonly used to provide a result back to the calling code.
return expression;
Example
C
#include <stdio.h> int add( int a, int b) { int sum = a + b; return sum; // Return the sum as the result of the // function } void printMessage() { printf ( "w3wiki\n" ); return ; // Return from the function with no value (void) } int main() { int result = add(5, 3); printf ( "Result: %d\n" , result); printMessage(); return 0; } |
Result: 8 w3wiki
Jump Statements in C
In C, jump statements are used to jump from one part of the code to another altering the normal flow of the program. They are used to transfer the program control to somewhere else in the program.
In this article, we will discuss the jump statements in C and how to use them.