The basic program outline looks like this:
#include <stdio.h>
#include <math.h>
int main()
{
...
...
...
}
Take a look at the program in ``joints.c'' and see that it fits the
general outline shown above. (Ignore the English text at the top of the
file--we'll talk about those lines in the next section.)
When you run a C program, the computer starts carrying out the commands that
are contained in the {}'s after the word main. In C, the word
main is required!
But what are all those other parts of the C outline for?
You might have noticed that the word int appears before the word
main in the C outline. You might be be asking yourself, ``What is the word
int there for?''
Click here for the answer.
And what about the parentheses after the word main?
Click here for the answer.
Finally, you've probably noticed that we haven't mentioned the lines that start
with ``#include''. What are those lines doing there?
Click here for the answer.
Right now, you don't really need to understand how the ``#include''
lines work, or even exactly what they do. For now it's safe to just follow the
program outline and always put the following two lines at the top of every C
program you write:
#include <stdio.h>
#include <math.h>
Eric N. Eide
Hamlet Project
Department of Computer Science
University of Utah