Hello World Program in C

Welcome to the fourth module of the C Programming series, in this particular tutorial we will talk about the Hello World Program in C, the most famous code, through which we will start our journey in the practical world of coding and also will see the structure of the program like how our code structure looks.

So, gear up your energy, Let’s go into the depth of this module.

Hello World Program in C

Hello World Program in C

This is the very first code which we will see towards the practical implementation of coding. The motive of writing this program is it tells us the basic structure of the program like how and what are the necessary and important things which we have to use while writing our code. This program simply prints the statement “Hello World” on the output screen. This is a simple code that makes us understand how c programs are executed and constructed.

Let’s see the code program:

#include <stdio.h>
int main( ) {
    printf ("Hello World");
    return 0;

When the above program will be executed, the output we get on the screen is:

Hello World

The above program can be written in many ways using the C Programming language, but as of now we will focus on these basic steps and structure and will cover all the more in the upcoming tutorials.

Structure of the Program

Structure of the Program

You all must have noticed many things written in the above program and also wondering what are all that, so let’s see the meaning of each line and thoroughly understand the structure of the program.

Header File: #include<stdio.h>

It allows to perform standard input and output function in the program such as scanf() and printf() function, we have used printf() function in the above code, or we can say Header files tells the compiler that the code is of C language and through this compiler imports all the necessary libraries to perform the operations. #include is the preprocessor here, which tells the compiler about the particular action that has to be done. stdio simply means standard input-output, which allows the compiler to perform the various input-output actions.

Main Function: int main ()

Here the function called main is declared of return type int. The program will begin its execution from the first line inside the main function and keep executing each line till the end. here int simply tells the user that the program is returning some value at the end ie.., we can see in the last 0 has been returned, it indicates the successful compilation of the code, if your code doesn’t return any value then you can go for void main also. void means the null value that no value has to be returned.

Output to be displayed on the screen: printf ( “Hello World” ) ;

This line is called the C Statement it has three parts the 1st one is printf function and the 2nd is the sentence or word you want to display out in the output screen and the last is the semicolon, to terminate the statement. The main work of this line is that it simply prints whatever is in the double quotes on the screen.

Return type: return 0;

This should be included in every program you write as it is the return of the int main. The value 0 indicates that the program has been executed successfully.

Curly Braces: { }

Start the block by using the curly braces “{” and end the block by using “}” these braces. All the contents between these braces are called the function body and that defines what happened when the main function is called. It tells the scope of the function that through this the function statement is valid and will be considered.

So, this was all about the structure of the program, these are the necessary things that must be included while writing any program.

I hope you all enjoyed the Hello World Program in C tutorial because finally, you all have landed in the practical world of coding, from now we will start our journey in the practical world of C Programming and will see many cool concepts for which you all must be waiting and must be excited too.

Until then stay connected, Happy Learning!