Write a Very Simple C Program

In this post, I am going to explain how to write a very basic C program.


Structure of a C Program

  • Every C program consists of one or more modules called functions.
  • One of the function must be called the main.
  • The program will always begin by executing the main function, which may access other functions.
  • Any other function definitions must be defined separately, either ahead of or after the main.






                statement(s) ;


  • Each expression statement must end with a semicolon (;)


Header files

Header is a system file, which contains some commands and functions need to write c/ c++ languages. When we need such functions and commands we should include their header file into the program at beginning.


stdio.h (standard input output)

conio.h (console input output)



Main function

This is the most important function and should include in every c / c++ programs. The main function performs the following operations

  1. Always initiate the c / c++ programs execution.
  2. Control other functions and commands in order to perform their process.
  3. The program statement generally included inside the main function block.


Clear screen function / clrscr()

Clear the statements from the output screen.



to open the output window and write the statements.



to hold the output window and in order to read the output statements.


Here for this example I’m using Turbo editor:




void main (){



printf(“welcome to www.learnlinky.com”);





One Response

  1. portefeuilles pas cher Louis Vuitton August 11, 2014

Add Comment