Introduction to C / C++ Programming
Functions

Motivation and Benefits

Syntax and Components

return_type function_name( arg_type argument, ... )  {
         local_variable_type  local_variables;
         executable  statement(s);
         return  return_value;
     }
int add( int a, int b ) {
         int sum;
         sum = a +  b;
         return  sum;
     }

 

Return Type

Function Name

Formal Parameter List

Function Body

The Return Statement

Function Prototypes