Home >Backend Development >C#.Net Tutorial >The role of return in C language

The role of return in C language

Guanhui
GuanhuiOriginal
2020-06-01 16:48:526678browse

The role of return in C language

The role of return in C language

The role of return in C language is to shift the program flow from the called function to the calling function , and bring the value of the expression back to the calling function to realize the return of the function value. The return can be accompanied by a return value, specified by the parameter after return. If the function without a return value is of empty type, it is represented by void.

Code example

int sum(int i,int j)
{
  return i+j;
  printf ("123456");
}
main()
{
  int a=10,b=11,c;
  c=sum(a,b);
  printf("%d",c);
}

The output of the program is: 21

Recommended tutorial: "C#》

The above is the detailed content of The role of return in C language. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn