C, through its standard libraries, provides a number of built-in functions. You have already seen a number of functions, defined in ``stdio.h'', that perform I/O operations. There are also a number of functions, defined in ``math.h'', that perform numerical calculations. Our first example program uses the function ``sqrt''. Look at ``sroot.c'' from your ``examples'' directory (or view it directly).
Experiment with running the program a few times.
In this program, notice that we include ``math.h'' as well as ``stdio.h.'' As we have pointed out before, all functions must be defined before they are used, and ``sqrt'' is defined in ``math.h''. Try taking out the line that includes ``math.h'' and see what happens.
Hamlet Project