Hello World in C Programming – Learn to Code Easily

Most beginners start their programming journey by printing Hello World in C programming or any other programming language.

In this tutorial, we will do the same, but we will learn each of the lines step-by-step. This will not only help you to understand the basic concepts but also helps you to learn in-depth. So, let’s get started with the full code and line-by-line explanation.

The Full Code

int main()
	printf("Hello World!");
	return 0;


I am starting with the ‘#‘ symbol, it tells us that this is a pre-processor. Well, what does that mean?

C compiler starts its execution from the main() function, but before that, it pre-processes the source code. The compiler will process the ‘#’ statement first, and then it will start the execution from the main() function.

Then we have ‘include‘, what do you mean by include, add or insert something, Right? Exactly, so here we are telling the compiler to include the stdio.h file in our program.

The stdio.h file contains all the functions to work with the inputs and outputs. It stands for Standard Input-Output(stdio) [ Please note, this is stdio, not studio ] Header file(.h is the extension for header files). And those two tags ‘< >‘ are specially used for the header files.

So, what does that means all together? It means we are instructing the compiler to include the stdio.h file in our program before main() execution. So that, we can work with inputs and outputs, especially with printf() and scanf().

There is a lot more we can do the pre-processor, we will see that in the upcoming tutorials.

int main()

This is main() function I was talking about. C compiler starts its execution from here. You may have your own defined functions declared at the top of your code, but then also it will start executing the code from main() function.

int main() represents integer main() function and it will return us some value. You must have main() function in your code.

All the statements inside the main() function are enclosed between these two curly braces { }.

printf(“Hello World!”);

Here we are telling the compiler to print Hello World!. So, we are using printf() function from the stdio header file to print the line, and that’s why the #include<stdio.h> was necessary.

printf() means print formatted, which means it obeys some rules, some formats. So, we just can’t write anything within the printf(), we need to know the syntax of the format.

Inside the parenthesis ( ) we have to put ” “. Inside the ” “, we can write whatever we want to print. Later, we will learn more about printf() in the upcoming tutorials, where we will learn to print values of variables and many more.

return 0;

We are using the int main() function, which means it will return some integer value. So, we are returning 0, if all the previous statements are true. If the compiler does not find any error before ending the main function, then it will return 0 which means a positive/true result, else it will return a non-zero number. return 0 also represents the end of the main function.

Watch Tutorial

That’s all for this code. Here is so much is going on for printing Hello World in C programming language within some seconds. Subscribe to get updates on Programming, Linux, Machine Learning tutorials, and do follow our YouTube channel.