Saturday, June 20, 2009

Structure of C-Program

Let us see first, structure of C program:

including header files
main function
{
variable declaraton;
input statement;
processing statement;
output statement;
}

Here clearly note that inside main declaration all statements are ended with semi-colon(;). This means in C any statement terminates with semi-colon(;)

including header files:
Header files are nothing but some set of predefined files. Which has functions and methods. This header file must be included while using the specific functions.

main function:
Every program begins with main function. This is starting point of the program.

variable declaration:
Variable is value while changes during the execution of the program. In C each and every variable must be declared before it is used in the program.

input statement:
In C input statement is used to get input/values from the user.

processing statement:
The user defined values are processed in this processing statements.

output statement:
The output statement are used to print/display the processed value to user.

Note:
All statements within main are enclosed with a pair of braces {}.