Compilation and execution process of C

Compilation and execution process of C program consists of different phases through which all C programs passes before the code transformed into an executable form which are described as follows :

Source code:

  • The codes which are written in a file using high level language by using different types of text editor such as vi or gedit is known as source code.
  • The file extension name must be ‘.c’ .

//e.g. program1.c

Object code:

  • The source code written in high level language converted into machine language by the C compiler.
  • If the compiler does not found any bugs(error) in source code a new code file is generated which is known as object code.
  • The file extension name must be .obj in windows and .o in Linux.

Executable code:

  • After getting object code some additional code is required to execute program.When these additional code added with existing object code the new code is called as executable code.

The extension name of executable file in windows is .exe and in Linux it is ./a.out.

All the above three process can be shown pictorially  as mentioned  below:COMPILATION AND EXECUTION PROCESS OF C


  • Compiler converts source code into object code if the source code has no bugs.


  • All C program use library functions. Library functions are the functions which are precompiled and their object is stored in library files.

Some others functions written in our program which may refer to library function. So the role of linker is to provide link between these files and generates executable code.


  • Comments in C program are internal documentation. Comments in C program basically tells about the program i.e. it simply explains what kind of function is going to done by the written program or objective of that program.
  • A good programmer should always use comments in program because sometimes in large programs (programs having more than 1000 lines)  it becomes difficult to go through the whole program and find out the purpose or objective of that program.
  • Comments in program becomes helpful to another programmer to find out purpose of writing that program. The compiler simply ignores the comments while converting the program into executable code.

Click here to purchase SAMSUNG Galaxy J7-6.

Comments in C program are of two type:

1)Multi line comment or Block comment

2) Single line comment or line comment 

Block comment:-

  •  This comment in C begins with forward slash(/) followed by asterisk(*) symbol and ends with asterisk symbol followed by forward slash i.e. block comment has opening and closing tokens (tokens refers to one or more symbols).
  • This can be written in multiple line as shown in  example below.

Example of block comment.                                                                                                                                                                                                                                           COMPILATION AND EXECUTION PROCESS OF C

Line comment:

The second format of comment in c is line comment. This comment begins with two slash(//). As block comment require of closing tokens this comment doesn’t require closing tokens; end of line simply denotes end of line comment.



  • Comments in a program can be given anywhere. After getting opening token of any  comment format the compiler simply ignores whatever written until getting closing tokens of comment.
  • The most important point to be remember in comments is that it should not be nested otherwise after getting ending token the compiler simply ignores rest part of comments which will lead to an error in program.

Click here to download pdf of compilation and execution process of C.


Leave a Reply