0% found this document useful (0 votes)
5 views6 pages

Compilation of C Prog

The document outlines the four stages of compiling a C program: preprocessing, compilation, assembly, and linking. Each stage transforms the source code into a different format, ultimately producing an executable file. The process includes removing comments, expanding macros, translating to assembly instructions, and linking object code with built-in functions.

Uploaded by

resam.zaha.hp
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views6 pages

Compilation of C Prog

The document outlines the four stages of compiling a C program: preprocessing, compilation, assembly, and linking. Each stage transforms the source code into a different format, ultimately producing an executable file. The process includes removing comments, expanding macros, translating to assembly instructions, and linking object code with built-in functions.

Uploaded by

resam.zaha.hp
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 6

The Four Stages of Compiling a C Program

•Preprocessing
•Compilation
•Assembly
•Linking
Preprocessing
• This is the first phase through which source code
• is passed. This phase include:
• Removal of Comments
• Expansion of Macros
• Expansion of the included files.
Preprocessing

After
preprocessing, filename.i is
produced
Compilation
In this stage, the preprocessed code is
translated to assembly instructions​
After compiling, filename.s is produced
Assembly
•During the assembly stage, an assembler is used to
translate the assembly instructions to machine code,
or object code.
After assemblinging, filename.o is produced
Linking
The linker will add the object code for
the built-in function and some extra work is
done here.
After linking, filename.exe is produced

You might also like