Erstellt von Xeenat S
vor mehr als 7 Jahre
|
||
In C, a function is an independent block of code that performs a specific task when called upon and it may return a value to the calling program.
A function may return one value at most. It specifies the type of value the function returns. If no value is to be returned, use 'void'. If the function doesn't have a return type, an integer value is presumed to be returned by the function.
The general form for a function definition is:
return_type function_name(parameter_list)
{
/* Function Body */
}
The return value of a function has to match it's return type else, the compiler changes it to match the return type. A return value isn't required for a 'void' function.