September 1998
Intermediate to advanced
848 pages
20h 13m
English
The traditional, pre-ANSI C scheme for declaring functions was deficient in that it declared a function's return type, but not its arguments. Let's look at the kinds of problems that arise when the old form of function declarations is used.
The following pre-ANSI declaration informs the compiler that imin() returns a type int value:
int imin();
However, it says nothing about the number or type of imin()'s arguments. Therefore, if you use imin() with the wrong number or type of arguments, the compiler doesn't catch the error.
Let's look at some examples involving imax(), a close relation to imin(). Listing 9.4 shows a program that declares imax() the old-fashioned way and then uses imax () incorrectly. ...
Read now
Unlock full access