Page t004, go to NEXT,
PREVIOUS, INDEX
Main Program
All programs must have a main
Most trivial program is
int main() {
return (0);
}
or, different style
int main()
{ return (0);
}
- under UNIX, suffix is .c
- main() is a function called by the OS
- this main() takes no arguments
- braces "{" and "}"
denote body of function
- main returns 0 to the OS (success!)
- a statement ends with semi-colon (";"),
otherwise completely free form
C Course, 15-jan-1997,
Peter Klok,
pfk@hef.kun.nl