Free programming examples and instructions

Hello world C Program

C prpgramming code hello world application

by Athil

Posted on 08 Jan 2017 Category: C Views: 1019

Edited on 21 Jul 2017

Hi, Here I am going to show how to start a C program. for that u need to install a C compiler. I suggest to install turbo c++ compiler for windows operating system, you can download it free cost. after installing it open turbo c plus plus compiler open the application and write the code that I written bellow.  after writing the code save the file with extension  '.c' and run the application. 

To Run the application

To run the application you can directly go to the menu Run -> Run.


Use the key board short cut Ctrl+ f9

you can see there any error/Warnings on your coding, If no errors/warnings you can press any key to continue then you can see the console window.





void main()
    printf("Hello World!");



Code explanation

The first part of the code is including libraries to the code. They are stdio.h and conio.h all libraries should be included at the top of the code.

We can include the libraries by two methods 

1 By typing #include<stdio.h> (library name inside greater than less than symbol).

2 By typing #include"stdio.h" (library name inside double quotes).

Both have the same value

Then the main function started. (void main() ) void means nothing return to the function main. void is the type of the function main. the whole code compile from main function. 

then the curly brace started ' {  } ' . The code inside the function should be written in curly braces.

clrascr(); is a function to clear the console window. you can try running code without the clrscr(); function line. you can understand what is working on it by second time running.

printf(); is function to print text to a console you can add text between double quotes.

getch(); is also a function to read a single character from console. I will exaplian how it works later.



Leave a Comment: