Hello World C Program | C Tutorial

By | January 1, 2016

Let us learn how to print hello world in C programming language in Linux Ubuntu operating system. We have also explained how to execute hello world C program in Linux Ubuntu.

The hello world program simply displays a Hello World to the end user. It is the very first program that every beginner programmer starts with.

This is helpful as this program is usually very simple to implement and it also helps you understand the basic elements and syntax of that particular programming language.

Alternatively, you can also print hello world in C programming without using the semicolon. Check it out here.

How To Execute Hello World in C Programming?

  1. Create a new text document using gEdit text editor in Linux operating system.
  2. Copy any of the following hello world programs, and paste it into your text document.
  3. Save the document with a .c extension.
  4. Open the Linux terminal by using the shortcut command Ctrl + T.
  5. Locate to the .c document directory by using the cd command as shown in the output at the bottom.
  6. Since GCC is the default compiler in Linux, type gcc filename.c command.
  7. To run the object file, type ./a.out command and it’s going to display the output.

If you’re in Microsoft Windows environment, please download a C compiler and have fun with C programming.


Note: This C program to write hello world program is compiled with GNU GCC compiler on Linux Ubuntu 14.10 operating system.

Method 1: Display Hello World in C Programming

Method 2: Print Hello World C Program using Command Line Arguments

Method 3: C Program To Print Hello World using Strings

Method 4: C Program To Display Hello World using Macros


Write Hello World in C Programming using Strings, Command Line Arguments and different methods

If you have any compilation errors or doubts about this C program to display hello world, let us discuss it in the comment section below.


Find more about Hello World program on Wikipedia.

4 thoughts on “Hello World C Program | C Tutorial

  1. Ajit Kadam

    You have used Hello World statement in Command Line Hello World Code. We have to print hello world in Command Line as arguments.

    1. Tushar Soni Post author

      We have passed default values here. If you want then you can remove this default value and pass your Hello World statement via command line. No issues in that.

  2. Mehak Chahal

    It is advisable to have return 0; statement at the end if you’re using int main() as it is considered as one of the best practices to program in C language.


Let's Discuss