Click here to print

Functions

A C program code is organized into functions. A program always starts with the main() function. This function can, using an instruction, call the code written in an other function. Until the end of the execution of this function, the main is suspended. This can be done recursively (each function can call one or several other functions).

A function is a named block. The function call is different from a child block inside a parent block (see previous page) because the context of the calling function is no more accessible, ie the variables declared and define in the calling function are not accessible in the called function.

Example 1 :