0% found this document useful (0 votes)
16 views3 pages

C Programming: Compilation Process Explained

The document outlines the compilation process of a C program, detailing the steps from pre-processing to linking, which ultimately produces an executable file. It explains the use of header files, specifically #include <stdio.h>, and defines functions as reusable blocks of code. Additionally, it emphasizes the importance of comments in enhancing code readability.

Uploaded by

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

C Programming: Compilation Process Explained

The document outlines the compilation process of a C program, detailing the steps from pre-processing to linking, which ultimately produces an executable file. It explains the use of header files, specifically #include <stdio.h>, and defines functions as reusable blocks of code. Additionally, it emphasizes the importance of comments in enhancing code readability.

Uploaded by

septornerg
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Lecture 06 — Computer Programming: Writing Code

Compilation Process in C

Before the C program is transferred into an executable form, it passes through the following:
1. Pre-processor The source code is passed to the pre-processor, which expands the code by:

expanding lines beginning with pre-processor directive #

removing comments

2. Compiler Checks the code for errors and then converts the pre-processed code into assembly code.

3. Assembler Converts assembly code into object code.

4. Linker Combines object code of library files and other files used by the program with our program's
object code. The output of the linker is an executable file.

Inside the C File

Header Files

A directive to place the contents of the header file in the program.

For this case, we will use #include <stdio.h>. By including this header file, we are directing the C
preprocessor to include contents of I/O in our program.

What are functions?

A function is a block of code that can be called to execute a set of statements. Multiple programs can
use the same function.

int add(int num1, int num2) {

int sum;

sum = num1 + num2;

return sum;

Adding Comments

Comments are integral to understanding a program and how it works. Use /* */or // to comment
something out.

bb

You might also like