Function is defined, the return value of the relationship between each part

Function is a function of a certain block of code, because of the smoke cloud processing data C, and the value of different types of memory have different memory storage methods, it has any data type, that nothing must have a name, so the function is defined
function type (type of return value) function name (parameter type name 1 parameter 1 parameter 2 parameter name type 2 ...)
{
function body
}
is a function of process parameters, to return certain data, which is a function of the function.
On void and return:
It can be appreciated that the functions can be divided into the presence or absence and or need to return a return value, may be combined two by two:
1, has a return value, need to return, is the general form
2, the return value, no return , before the function names are void, and the return value of a function body can not appear, but only a return.
3, no return value, no return, there are void function name, and the return value of a function body can not occur, but only a return.
4, no return value, need to return, that the absence of
the above that the function name with a void exists, a body of the function to return a value not appear, 2, but can occur only return,. 3, nothing can occur
primary transfer function from the position of the called function, into the called function of argument (parameter value passed to the calling function called function) operation, when the end of the transfer function is executed, the calling function and then continue with the rest from here part, of course, a function can be called multiple times.
Call mechanism between multiple functions:
function is a function compiled function or the function is called first want to know I want him to do, is I 1, to this function what dataAfter operating the function body, I can get anything, this point must think clearly. 2, then is how to operate; these are two points need to think about, and the order to be correct. After then perform this function, I'll get some of the data I wanted . Note that the enlarged portion, and performs data obtained can be used as a parameter to another function .
Example:
2 * (A + B C)
here has three functions, a function is added, by a function, a 2
function of a number of.
1, defined by the first function, the function is two atoms in a body, to return the plot, the function is called two arguments must be known. Call is completed, note that at this time the product is known, as a function of the other parameters
is 2, then add the definition of the function, the function thereof is the sum of two values, and return, calling function calling the function, two arguments including the first step in the return value, because it is already known of.
3, 2 * function can be defined, it can also be used by a first function, which time function body 2 is first multiplier, the second multiplier and the second step is

Published 21 original articles · won praise 0 · Views 354

Guess you like

Origin blog.csdn.net/gaoxingzhe/article/details/104880441