1 2 3 4 5 6 7 8 9 10

Functions and Procedures

*

There are two ways of declaring and defining procedures in C, the old way and the ANSI standard way - you may run into both, but use only ANSI form

All procedures in C are really functions, that is they return a value. The special type voidindicates that a return value is not used (not wanted). Such void functions are called procedures.

C has both function declarationsandfunction definitions - these are two different concepts

A function declarationcontains all the information required to call the function, that is the name the types of the parameters and the type of the return value. These declarations are also called prototypes.

A function definitionincludes all the information in a function declaration, plus local variables and the statements in the function - It not only describes how the function can be called, but also how it computes its value

*

*

*

*

January 22, 1999

Page 3

copyright UoA