{ A destination to learn coding }

Jump Statements

The return statement

The return statement is used to return from a function.
It causes the program control to jump back to the point at which the function was called.

A basic example
#include<stdio.h>
int main()
{
printf("Hello World");

return 0;
}

In C, since the main function is of integer data type, we return 0.


Why do we return 0 in C and not any other integer?

In most of the operating systems, the main() function is usually supposed to return 0 in case of successful operation of the program, and any non-zero value in case of error(failure)

return statement plays a major role in functions. You will learn more about it in the later chapters.

C Codes