Functions are the building blocks of C and C++ and the place where all program activity occurs.
The general form of a function is:
SYNTAX
Return-type function-name (Parameter-list)
{
Body of function
}
The return-type specifies the type of that the function returns. A function returns all type of data except array. The parameter list is a list of variables which is separated with a comma. These variables must have their types associated with them. The parameters of a function are optional.
Even though the parameter list is optional, the parentheses are not optional. The variables in the parameter list must be declared individually.
For example, here is correct and incorrect function parameter list declaration:
EXAMPLE
Int f(int I, int k, float y); //correct
Int f(int I, k, float y);//incorrect
Administrador de ENGGDRCAOS. Canal dedicado especialmente a la formación del estudiante que aspira a ser ingeniero. Todos los videos son Ingles. Apasionado del universo Apple, estudiante de Ingeniería y Gamer por vocación.