Menu

Return Statement in C

  • retun statement is also a jump statement.
  • The return statement terminates the execution of a function and returns control to the calling function.
  • The return statement terminates the execution of a function and returns control to the calling function.

Syntax

           return expression;

  • The value of expression is present, it will return to the calling function.
  • If expression is omitted, the return value of the function is undefined. 
  • If no return statement appears in a function definition, control automatically returns to the calling function after the last statement of the called function is executed.
  • The return statement in the main function terminates the program.

Example

     #include<stdio.h>
     main(){
       int a=10;
       int b=20;
       return(a+b);
     }