Hello World C

Program With Code Blocks

Here, we will learn that how to write c program in Code Blocks and how to use Code Blocks to write hello world C program and for C programming.

But before starting programming with C language, we need to know these three things.

  1. How to write C program

  2. How to compile C program

  3. How to run C program

Three steps to create any C program :

We will have to follow at least three steps to create any C program. All the three steps are given below.

1  Writing C Program : We can use any text editor for writing C program like Windows's Notepad editor, Linux's Vim editor etc.

2  Compiling C Program : For compiling C program, we need a compiler software. A compiler is a special computer program that transforms source code written in a programming language into binary or machine language. As you remember that we have already discussed What is a compiler? in previous section.

3  Running C Program : To run C program, we need a platform like Windows/Ubuntu/Linux.

Integrated Development Environment (IDE) : With IDE, we can get all these steps at one place and IDE makes development easy.

C Hello World

Now, we will see that how to write C hello world program with Code blocks IDE.

Following steps, We need to follow for creating hello world C program with Code Blocks :

1 Open Code Blocks : Go to Desktop and double clicks on Code Blocks icon or click on Windows's start menu and then click on All Programs and find Code Blocks from list and click on it.

2 After Opening : Click on File Menu and then click on New option and then click on Empty File or press Ctrl+N.

3 Type or Enter Code : Type or enter code like this.

write code for C program in code blocks
write code for C program in code blocks

4 Save Source File : Click on File Menu and select Save File option or press Ctrl+S. After that a window will open and on this window type File name with c or cpp extension like hello.c / hello.cpp after that click on Save button.

5 Run Program : Click on Build Menu and select Build and run option or press F9. After that a window will open.

run c program in code blocks
run c program in code blocks

Once you have done with build and run the program. now go to that directory or folder where you saved your C source file. inside this folder, you will get an executable file like hello.exe. You can run this executable file directly clicking double.

6 congratulations !!, You have been successfully run your first C program with Code Blocks IDE.

Info : We will understand this program in coming sections, that why we wrote main, int , getch, printf etc in this program.
Understand Now