Monday, July 8, 2019

Phases of Execution of C Program


Phases of Execution of C Program:

Execution of C Program occurs in 4 phases.

  1.  Writing the code
  2. Compiling the program 
  3. Linking
  4. Execution

process of execution of c Program

Phases-of-Execution-of-C-Program



Writing the code:

It refers to the first step. In the code, we use various Constructs & loops. The main benefit is the ability to break down the code into various modules. This file has the extension of .c

 Compiling the program:

Once the program has been written, the code needs to be converted into the machine language ,i.e. the machine can understand. This conversion takes place with the help of a compiler.
But the Conversion takes place only after all the bugs from the source code have been removed. On compilation, the compiler reports all the errors from the source code, the source code is compiled and converted to machine code, So , the compiler converts C code to binary code i.e. object code.

Linking:

The compilation has already been done. The obj file has been genrated. But for execution of a program, the referred function of the library files must be made available to the source file. This is done with the help of linker. It is used to link the library files with the source code. After the linking, a file with the extension “.exe” is genrated. This is called the executable file.

Execution:

The final stage is executing a C program ie. To run the program. This is done by opening the DOS Command Prompt or by any other software.

This is all about the phases of execution of a C Program.

Thanks for reading......

0 comments: