Hello World Program in C language



Whenever we start learning new programming language, We always start with the famous “Hello World” Program.

By Writing, Compiling, and running the Hello world program, We will get familiarise with the Language syntax and We will learn how to compile the program and run the program.

So while we are just starting to learn the C programming language. It is a good idea to start with the hello world program. So let’s write a Hello World C Program to get comfortable with Language.

Hello World Program in C programming Language:

In this program we are going to print text “Hello World !” onto the computer screen.

To print the "Hello World !" string onto the computer console, We are going to use the C language printf function. The printf()function will take string as the input and Display provided string on the screen.

In this program, We are going to pass “Hello World !” string to printf function, to get “Hello World !” as output.

Lets write the following code into notepad and save it as hello.c

If you already installed the C IDE ( Integrated development environment). Then open your IDE and enter the following code.

If you are using Linux operating system, Then by default you will have C Compiler installed. That is GCC compiler. So Open any of your favourite notepad and enter above code and save the file as hello.c . We will learn how to compile the code in a minute.

If you are in Windows operating system, We suggest you to download and install the CodeBlocks IDE from the following link

Downloads – Code::Blocks (codeblocks.org)

Once you got your IDE up and running, Copy and paste above code and save the file with .c extension.

Compiling Hello World C Programs:

If you are in Linux operating system then you can use GCC compiler to compile and run your program, To compile your program using gcc compile use following command.

Here we used gcc and followed by the file name. The gcc is the compiler and our file name is "hello.c". Once you hit the enter gcc will generate a executable file named a.outunder the same directory/folder.

As we have not provided any name for our output file, GCC uses the default file name called a.out. You can also pass -o option to gcc while compiling to give name to your executable file. Something like below.

In the above command, We have specified the gcc compiler to create the executable with the name of “ myexecutable

So once you run the above command, GCC will generate a file named myexecutable under the same directory. We can run that myexecutable file to get desired output.

Running C Programs:

Once we compiled our program, We will get the executable file, If you haven’t provided any name for your executable file, Then by default executable in Linux and Mac OS is a.out

Once we get the a.out executable file, Then run the file using following command

In above command a.out is filename and the initial letters ./means the present directory.

Finally, Here is the output of program.

📢 In this article, I have used the Linux System to Compile and run the program. So If you are Windows once you configured the IDE, you can find the build and run options from the top menu.


In this article, We discussed about how to write, compile and run C program in windows, Linux and Mac OS. We also written a simple Hello world program to understand the syntax and get comfortable with the language.

Related Article:


Hi Guys, I am Venkatesh. I am a programmer and an Open Source enthusiast. I write about programming and technology on this blog.

You may also like...

6 Responses

  1. […] Hello World Program in C language […]

  2. […] We are going to compile the program using the gcc compiler. You can learn more about the compiling and running c program in following article. Hello World Program in C language – SillyCodes […]

  3. […] Here is a quick tutorial to how to run programs in Linux – Hello World Program in C language – SillyCodes […]

  4. […] 📢. Learn More above compiling and running program following article – Hello World Program in C language – SillyCodes […]

  5. […] Please learn more about compelling and running program in Linux at following article – Hello World Program in C language – SillyCodes […]

  6. […] our previous article, We have discussed about the Hello World Program in C Language. Now in this article, We will discuss about the Character Set in C […]

Leave a Reply