#include line in the above program is a reference to a special file called stdio.h (called the header file contains predefined programs for standard input and output functions). Any statement starting with # is called preprocessor directive.
main() is the starting function which contains executable statements in between two curly braces { and }. Curly brackets are used to group statements together as a function or in the body of loop. Such group is called as compound statement or block.
Important points to remember:
- Every C program requires a main() function. Use of more than one main() is illegal. The place of main() is where the program execution begins.
- The Execution of the function begins at the opening brace and ends at the closing brace.
- C programs are written in lowercase letters. However uppercase letters may be used for symbolic names and constants.
- All the words in a program line must be separated from each other by at least one space or a tab, or a punctuation mark.
- Every statement must end with a semicolon.
- All variables must be declared for their type before they are used in the program.
- Compiler directives such as define and include are special instructions to the compiler, so they do not end with a semicolon.
- When braces are used in the program make sure that the opening brace has corresponding ending brace.
- C is a free form language and therefore proper form of indentation of various sections would improve the legibility of the program.
A comment can be inserted almost anywhere a space can appear. Use of appropriate comments in proper places increases the readability of the program and helps in debugging and testing.