C-The “Hello World” Program

A C program consists of one or more functions or code modules. These are essentially groups of instructions that are to be executed as a unit in a given order and that can be referenced by a unique name. Each C program must contain a  main() function. This is the first function called when the program starts to run. Note that while “main” is not a C keyword and hence not reserved it should be used only in this context.

A C program is traditionally arranged in the following order but not strictly as a rule.

Function prototypes and global data declarations
The main() function
Function definitions


Consider first a simple C program which simply prints a line of text to the computer screen. This is traditionally the first C program you will see and is commonly called the “Hello World” program for obvious reasons.


#include <stdio.h>

void main()


/* This is how comments are implemented in C to comment out a block of text */

// or like this for a single line comment

printf( “Hello World\n” ) ;


error: Content is protected !!