C Hello World

Summary: in this tutorial, you will learn step-by-step how to develop the first simple but famous program called C Hello World.

A C program consists of functions. A C program always starts executing in a special function called main() function. The following is the C Hello World program that displays a greeting message on the screen.

Let’s examine the program in more detail.

  • First, we have the #include directive. Every directive in C is denoted by a hash ( #) sign. C program uses this directive to load external function library. In the program, we used the stdio.h library that provides standard input/output functions.  We used the printf() function, which is declared in the stdio.h header file, to display a message on the screen.
  • Next, you see the main() function. The main() function is the entry point of  every C program. A C program logic starts from the beginning of main() function to its end.
  • Third, you notice that we used the printf() function that accepts a string as a parameter. The printf() function is used to display a string on the screen. The main() function is supposed to return an integer so we put the return 0 statement at the end of the program. You can omit the return statement, which is fine.

Developing C Hello World program in CodeBlocks IDE

In the following section, we will show you step-by-step running the C Hello World using CodeBlock IDE. If you don’t have any C IDE installed in your system, you can setup CodeBlocks IDEB by following the setting up C development environment tutorial.

Launch the IDE, and create a project from the menu File > New > Project…


Choose Console application



Choose C language


Enter project name and folder to create project



Click Run button you will see the console window display the Hello world! message

C Hello World

Congratulation! You have been successfully developing and running the first C Hello World program. Let’s go to the next tutorial to explore the power of C programming language. Enjoy programming with C!

  • Was this tutorial helpful ?
  • YesNo