※スタイルシート未対応ブラウザではレイアウトを正確に再現できません。
> | advanced by | contents  | that returns in <
< [modosusu] > Color magazine monochrome light and shade   font predetermined, Gothic Ming-style type longhand   size Konaka large   standard

Return the numerical value from the function.

1. ..clause 1..: Function that returns return value
2. ..clause 2..: Limitation of return value

[1] Function that returns return value

Though it explained the method of passing the function the numerical value in the foregoing paragraph
This time, it explains the method of inversely returning the numerical value from the function.

Actually, to have already returned the numerical value, the sum function is made.
Look at the sum function of the foregoing paragraph for the time being.

``` int sum(int min,int max)
{
printf("%d\n",(min + max) * (max - min + 1) / 2);
return 0;
}
```
A noteworthy point is two places.
One is a character string named int that is attached ahead of the function name.
Only though this mimics becoming so by the main function
Actually, this shows the type of the numerical value that returns from the function.

Another point is return sentence.
Though it has applied without fail without thinking about the current, especially anything at the end of the function
Actually, the function of returning the numerical value to this return sentence is provided.

In a word, this sum function is a numerical value of the int type 0 was supposed to be returned.
Such a numerical value that comes back from the function might be called a return value (function value).

[   Return value   ]
Numerical value returned from function.
It is often an numerical value that shows the presence of the numerical result or the error.
It is necessary to substitute it for the variable to know the return value in the call origin.
Do as follows to substitute the return value of the sum function for variable value.
```
value = sum(50,100);
```
Not only display the numerical result but also if you use this return value
It is possible to teach to the call origin as a numerical value.
It can be displayed and it use it to calculate at the call origin.
The following program is an example of remodeling the sum function to return the numerical result.
```
#include <stdio.h>

int sum(int,int); /* Prototype declaration */

int main(void)
{
int value;
value = sum(50,100);
printf("%d\n",value);
return 0;
}

int sum(int min,int max)
{
int num;
num = (min + max) * (max - min + 1) / 2;
return num;
}
```
The execution result of this program becomes as follows.

3825
This sum function only returns the numerical result though ahead nor the result change.
The result is displayed by using the printf function by the main function.
It is also possible to use the return value for another calculation by the main function if it is necessary.

It returns to contents.

[2] Limitation of return value

In the argument explained in the foregoing paragraph, two or more arguments were able to be used.
Curettage is not effective though I want to say Then, even the return value : naturally ･･･.
Very, only one return value can be returned.

The return value has only the resignation by one because it becomes it so.
Actually, postpone this though there is [waza] to which the numerical value is returned by the argument, too.

Though it was necessary to specify when calling it for the argument
You may disregard the return value.
To tell the truth, though the printf function also returns information how many characters to have displayed
Frankly speaking, because it is information with a good such throat a boil, it has been disregarding it.

The type that it likes double besides int can be used also for the return value.
Moreover, it is also possible to make the function that doesn't return the return value.
In that case, specify void ahead of the argument name.
There are unexpectedly a lot a return value unnecessary if it is very a very simple function.

It returns to contents.

< - It is advanced -> | in | head that returns  to returning  next |.