Page t032, go to NEXT,
PREVIOUS, INDEX
Header Files and Definitions
In math.h we have declarations
extern double sqrt (double);
extern double sin (double);
extern double cos (double);
/* and many more declarations ... */
In math.c we have definitions
#include <math.h>
double sqrt (double)
{ /* compute result */
return result;
}
double sin (double)
{ /* compute result */
return result;
}
/* more definitions ... */
- #include includes the contents of the named file
- declaration in header files is used in compilation of the library
function
- any mismatch between declaration and definition is flagged as warning
- so check compiler warnings
C Course, 21-jan-1997,
Peter Klok,
pfk@hef.kun.nl