Creating and Running Your First C Program

Before writing your first C program, you need to create the project first, so here I am going to create the project on Dev-C++ and mentioning all the steps. A project can have multiple files or single file depend on requirement.

Note: If you don’t have installed Dev-C++ yet, see this article, Install Dev-C++ 

Steps to create a project on Dev-c++:

Click on the Dev-C++ shortcut and Go to File > New > Project. See the below screenshot.

Creating and Running The First C Program


After clicking on the new project a window will open, where we need to select application and language type. Here also need to write the project name. Here I am creating a console application and select C as the programming language for the project. Here the project name is “FirstProgram”.

The First C Program


In the next window enter the file name as “main” (later you can add more fille as the requirement).

First C Program


Once the project is created, Dev-C++ will look like below screenshot.


First C Program


Now write your code in the main function, I am printing here message “hello aticleworld” using the printf (standard library function used to display the message on console).

Creating and Running Program


After writing the code, you have to save your program. In Dev-c+ +, you can save the program by pressing Ctrl + S or hitting save icon in the toolbar.

Creating and Running The First C Program


Compile the program by selecting Execute > Compile from the menu bar or by hitting F9. If compilation succeeds, you will see some messages on the compile Log tab of the Logs Window.

Creating and Running The First C Program


Notice the line of the log which says “Errors: 0, Warnings: 0 “. It means that the program is compiled successfully without any errors and warnings.

First C Program


If programme compiles successfully, then run the program by selecting Execute > Run from the menu bar or by hitting F10.

C Program


When you run the program, then the command window will open and display the message.

Creating and Running The First C Program