What are the 4 steps to convert C program to Machine code?

A program contains a set of instructions which was written in a programming language.
A program contains a set of instructions which was written in a programming language.
The programmer’s job is to write and test the program.
The programmer’s job is to write and test the program.
The 4 steps to convert a ‘C’ program into machine language are &miuns;Writing and editing the programCompiling the programLinking the programExecuting the program
The 4 steps to convert a ‘C’ program into machine language are &miuns;
Writing and editing the program
Compiling the program
Linking the program
Executing the program
‘Text editors’ are used to write programs.
‘Text editors’ are used to write programs.
With the help of text editors, users can enter, change and store character data.
With the help of text editors, users can enter, change and store character data.
All special text editors are often included with a compiler.
All special text editors are often included with a compiler.
After writing the program, the file is saved to disk.
After writing the program, the file is saved to disk.
It is known as ‘source file’.
It is known as ‘source file’.
This file is input to the compiler.
This file is input to the compiler.
“Compiler” is a software that translates the source program into machine language.
“Compiler” is a software that translates the source program into machine language.
The ‘C’ compiler is divided into two separate programs.PreprocessorTranslator
The ‘C’ compiler is divided into two separate programs.
Preprocessor
Translator
Let us first see about Preprocessor −
Preprocessor reads the source code and then prepares it for translator.
Preprocessor reads the source code and then prepares it for translator.
Preprocessor commands start with ‘#’ symbol.
Preprocessor commands start with ‘#’ symbol.
They tell the preprocessor to look for special code libraries and make substitutions.
They tell the preprocessor to look for special code libraries and make substitutions.
The result of preprocessing is known as ‘translation’ unit.
The result of preprocessing is known as ‘translation’ unit.
Translator’s work is to convert the program into machine language.
Translator’s work is to convert the program into machine language.
It reads the translation unit and results in ‘object module’.
It reads the translation unit and results in ‘object module’.
But it is not completely executable file because it does not have the ‘C’ and other functions included.
But it is not completely executable file because it does not have the ‘C’ and other functions included.
‘Linker’ assembles I/O functions, some library functions and the functions that are part of source program into final executable program.
‘Linker’ assembles I/O functions, some library functions and the functions that are part of source program into final executable program.
‘Loader’ is the software that is ready for program execution into the memory.
‘Loader’ is the software that is ready for program execution into the memory.
In the process of execution, the program reads the data from the user, processes the data and prepares the output.
In the process of execution, the program reads the data from the user, processes the data and prepares the output.
Following example is to find the average of 3 numbers −
 Live Demo
#include<stdio.h>
int main(){
   int a,b,c,d; //declaring 4 variables
   float e;
   printf("Enter values of a,b,c:");
   scanf("%d,%d,%d",&a,&b,&c); //read 3 input values from keyboard
   d=a+b+c;
   e=d/3;
   printf("Average=%f",e); // printing the result
   return 0;
}
Enter values of a,b,c :2,4,5
Average=3.000000
The following is to compute circumference of a circle −
 Live Demo
#include <stdio.h>
#define PI 3.1415 // defining PI value
main (){
   float c,r;
   printf("Enter radius of circle r=");
   scanf("%f",&r);
   c=2*PI*r;
   printf("Circumference of circle c=%f", c);
}
Enter radius of circle r=5.6
Circumference of circle c=35.184799