ExamTray App is now Available on Google Play EXAMTRAY android app link

 

Last Minute C Programming Build Process Tutorial

c program build process infographic

Output of any C Program is converted to an EXE file in Windows Systems so that you can execute the file and get the desired output everytime. In this tutorial we shall teach you what is the meaning of Building a C Program.

Note: Any C program is named with a .C File Name Extension. Usually Editors like Eclipse or Turbo C are used to type a C Program. A C Editor is just like a Notepad software that allows us to Type a new program or edit an existing program. It can not compile or assemble any code.

C Program Build Process

A C Program is built in a number of steps. Final outcome of the build process is the generation of an EXE file. There are 4 steps involved in building a c program.

  1. Preprocessing
  2. Compiling
  3. Assembling
  4. Linking

1. Preprocessing

Preprocessing in C language is the inclusion of Macro definitions, Header files and Conditional Compilation directives and more. Preprocessing expands the original source code with extra code. Preprocessing produces a file with an extension of DOT I (.i).

#include<string.h>
#define PI 3.14
int main()
{
  float radius = 2f;
  float area = 0;
  #ifdef PI
    area = PI * radius * radius;
  #else
    area = 3.1415 * radius * radius;  
  #endif

  printf("AREA=%f", area);

  return 9;
}

2. Compiling

Compiling a C program turns the source code into Assembly Code. Assembly code is fed to an Assembler.

3. Assembling

An Assembler converts ASSEMBLY Code to Machine Level Code Object Level Code.

4. Linker

A linker links Object Code of Program and Object Code of other library functions. Output of Linker or Linking process is Generation of DOT EXE (.exe) file in Windows based Systems. In Linux based Pcs or Systems, DOT OUT (.out) or DOT ELF (.elf) file is created as an Output.

Note: ELF stands for Executable and Linkable Format.

 

C Online Test on Build Process

1  C Program Build Process Online Test