Structure of C program

Before discussing any special feature of C, we Shall look at some C program, and analyze and understand how they work. The only way to learn a new language is by writing program in it. The first program to Print the words.

C Code Example

#include <stdio.h>
void main()
       printf("Hello World!");

Let’s examine this program line by line:


At the beginning of all the programs that use any input/output library function. However, this is not necessary for the function like getchar() and putchar() which have been defined as the part of the c language.


The main() is a special functions used by C system to tell the computer where the program starts.Every program must have one main function. The empty pair of paranthesis immediately following main indicates that the function main has no arrgument (or parameters).

{ and }

The opening braces “{” in the third line marks the begining of the function main and closing function braces “}” in the last line indicates the end of the functions.In this case, the closing brace also marks the end of the program.All the statements between the braces form the function body.The function body contains a set of instructions to perform the given task.


let us now look at the printf function, the only executable statement of the program.printf is a function which is declared in a stdio header file which allow to write data on standard input buffer.