Function Prototype

  1. A function prototype specifies how a function can be used, i.e. how it is called or evoked.

  2. The function prototype gives the name of the function, the number of function parameters (or arguments), the parameters' types, and the type of the value returned by the function.

  3. The syntax for the function prototype is:

    Type-Returned Function_Name(Type1 Parameter_Name1, Type2 Parameter_Name2, ...);

    where Function_Name is the name of the function, Type-Returned specifies the type of the value returned by the function.
    Parameter_Name1, Parameter_Name2, etc are the names of the parameters of the function, and Type1, Type2, etc. are their corresponding types.

  4. A function may have any number of parameters, including zero. The parentheses must be included even if the function has no parameters.

  5. The function may not return a value. In that case the Type-Returned is void.

  6. In the function prototype, one has the option of omitting the parameter names, but not their types. However we do not recommend that you should do that here.

  7. For example, we want to introduce a function that computes the area of a circle in terms of its radius. We use the name CicleArea for the function. The function has the radius as a parameter. We will use the parameter name Radius for the radius. The function will returned the area. Both the radius and the area are of type double. So a function prototype may be written as:

    double CircleArea (double Radius);