Professional Documents
Culture Documents
1 Function in c adv
1 Function in c adv
Function
The function is a self-controlled program that carries out some specific,
Well defined task. The large problem may be decomposed into small or
easily manageable parts or modules called function.
User-defined function
int function-name(…….)
float function-name(………)
void function-name(……..)
char function-name(…….)
2. Function name
The function name is an identifier. The naming of a function must
follow the same rules as an identifier. Whenever the function is called
the control is transferred to the function name. The function name is
relevant to the function operation. For example
sum()
square()
sub()
3. Argument
The argument is valid variable names separate by a comma and they
must be declared within the parentheses. The semicolon is not allowed
after closing parenthesis. The function receives the data into the
variables from the calling function, these variables are called a formal
argument. The formal arguments are also known as parameters or formal
parameters.
return;
or
return (expression);
The first, the 'plain' return does not return any value; it acts much as the
closing brace of the function. When a return is encountered, the control
is immediately passed back to the calling function.