Introduction
Computers have become an essential part of our lives, empowering us to perform complex tasks with simplicity. For anyone venturing into the world of programming, starting with a basic C program like "Hello World" is a common first step. This program, although simple, lays the foundation for understanding the structure and syntax of C programming.

In this article, we will learn how to write, compile, and understand a "Hello World" program in C. This program is your first baby step into the world of computer programming.
C Program to Print "Hello World"
To begin our journey in C programming, the first task is to create a program that displays the message "Hello World" on the screen. This is a simple program that helps you understand the basic format of a C program. Here’s how you can write it:
Output
Hello World
This code snippet consists of :
- #include <stdio.h> tells the compiler to include the Standard Input Output library, which is necessary for using the printf function.
- int main() is the starting point of any C program. This is the main function from where the execution of the program begins.
- Inside the main function, printf("Hello World\n"); is used to print the text "Hello World" on your screen. The \n at the end of "Hello World" is a newline character that moves the cursor to the next line.
- return 0; signals that the program has completed successfully.
Explanation of the Code
Understanding each part of the "Hello World" C program helps you learn the fundamental concepts used in more complex programs. Let's break down the code:
Header File Inclusion
#include <stdio.h>
This line includes the Standard Input Output header file in the program. This header file is necessary because it contains the declaration of the printf() function, which we use to print text to the console.
Main Function Declaration
int main() {
This is the declaration of the main function. In C, the main function is where the execution of the program begins. The int before main indicates that the main function will return an integer value.
Printing to Console
printf("Hello World\n");
Here, printf() is used to output the text "Hello World" to the console. The \n is a newline character that causes the cursor to move to the beginning of the next line, ensuring that any subsequent output starts from a new line.
Return Statement
return 0;
This statement is used to exit the main function and return control to the operating system. return 0 indicates that the program ended without any errors. The value returned is the "exit status" of the program, where 0 typically means success.
Note -: Each element in this program has a specific role, and together they introduce you to the syntax and structure of C programming. By learning these basics, you can tackle more complex programs very easily that use similar elements but perform more complex operations.