the function main
![]()
C programs are collections of functions designed to perform a specific task and return a computed result. All C programs must have one function called main. It declares variables and contains executable statements. Here's what it looks like.
The body of the function is contained in braces { }. The argument list in parenthesis after the word main is empty, which means that the function has no arguments. The word int that appears in the function heading indicates that the function main returns an integer result when it completes execution.
main is sometimes referred to as a driver function, because it tells the other functions the order in which they are to operate.
The last line in main should be
This indicates a successful completion of the function main, and returns a value of 0.