Hello World in C

Hello World program


Hello World !!


Let’s understand our first program step by step.


Here #include is the Pre-processor. Pre-Processors starts with hash symbol(#). It instruct the compiler to do required pre-processing before the actual compilation.

In this program #include<stdio.h> has been used to instruct compiler to include/load the stdio.h header file library before executing it.

Header File:

Header files are collection of built in functions that can be directly used in program.

In this program inbuilt function printf present in stdio.h has been used to display “Hello World” on screen. Header files have .h extension.

main( ) :

The execution of C program starts from main().

The braces indicates the beginning and ending of the main() function. All the statements between closing and opening braces { } are called the “function body”.

Return Type:

Here we have used int return type before main().This is called as the return type of function. This can be any datatype that we want the function to return. Here we don’t need anything to return so we are returning 0 integer as the return type is int.

printf( ):

printf( ) is inbuilt standard C function used for displaying some message on screen.

return Statement:

return statement is defined at the end of function to return the some value. Here we used int return type so we are returning an integer at the end of the function.


Comments are the part of code that are not executed. They are used inside a program to make the source code easier to understand.

For single line comments // is used at the beginning of statement.

Multiple lines comments begin with /* and ends with */ .


Sum of a & b is 6
Sum of a & b is 6.00000

The statement, int a,b,c and float c1 are used to declare the type of data that variable a,b,c,c1 will store.

Here a,b,c,c1 are variables to store numeric data. a, b, c will store integer values and c1 will store floating values.

Key points
  • In a C program, the semicolon is a statement terminator.
  • C is case sensitive language. For example “scanf” and “SCANF” are different in C language.
  • int , float are Keyword, It can't be used as variable name.

Do You Know?