C is a compiled language. So once a C program is written, you must run it through a C compiler that can create an executable file to be run by the computer.
COMPILING
AND EXECUTING C PROGRAMS
C
is a compiled language. So once a C program is written, you must run it through
a C compiler that can create an executable file to be run by the computer.
While the C program is human-readable, the executable file, on the other hand,
is a machine-readable file available in an executable form.
The
mechanical part of running a C program begins with one or more program source
files, and ends with an executable file, which can be run on a computer.
The
programming process starts with creating a source file that consists of the
statements of the program written in C language. This source file usually
contains ASCII characters and can be produced with a text editor, such as
Windows notepad, or in an Integrated Design Environment. The source file is
then processed by a special program called a compiler.
Note
Every
programming language has its own compiler.
The
compiler translates the source code into an object code. The object code
contains the machine instructions for the CPU, and calls to the operating
system API (Application Programming Interface).
However,
even the object file is not an executable file. Therefore, in the next step, the
object file is processed with another special program called a linker. While
there is a different compiler for every individual language, the same linker is
used for object files regardless of the original language in which the new
program was written. The output of the linker is an executable or runnable
file. The process is shown in Figure 2.4.

In
C language programs, there are two kinds of source files. In addition to the
main (.c) source file, which contains
executable statements there are also header (.h)
source files. Since all input and output in C programs is done through library
functions, every C program therefore uses standard header files. These header
files should be written as part of the source code for modular C programs.
The
compilation process shown in Figure 2.5 is done in two steps. In the first
step, the preprocessor program reads the source file as text, and produces
another text file as output. Source code lines which begin with the # symbol
are actually not written in C but in the preprocessor language. The output of
the preprocessor is a text file

which
does not contain any preprocessor statements. This file is ready to be
processed by the compiler. The linker combines the object file with library
routines (supplied with the compiler) to produce the final executable file.
Programming in C: Unit I (b): Introduction to C : Tag: : - Compiling and Executing C Programs
Programming in C
CS3251 2nd Semester CSE Dept 2021 | Regulation | 2nd Semester CSE Dept 2021 Regulation
Professional English II
HS3251 2nd Semester 2021 Regulation | 2nd Semester Common to all Dept 2021 Regulation
Statistics and Numerical Methods
MA3251 2nd Semester 2021 Regulation M2 Engineering Mathematics 2 | 2nd Semester Common to all Dept 2021 Regulation
Engineering Graphics
GE3251 eg 2nd semester | 2021 Regulation | 2nd Semester Common to all Dept 2021 Regulation
Physics for Electrical Engineering
PH3202 2nd Semester 2021 Regulation | 2nd Semester EEE Dept 2021 Regulation
Basic Civil and Mechanical Engineering
BE3255 2nd Semester 2021 Regulation | 2nd Semester EEE Dept 2021 Regulation
Electric Circuit Analysis
EE3251 2nd Semester 2021 Regulation | 2nd Semester EEE Dept 2021 Regulation
Physics for Electronics Engineering
PH3254 - Physics II - 2nd Semester - ECE Department - 2021 Regulation | 2nd Semester ECE Dept 2021 Regulation
Electrical and Instrumentation Engineering
BE3254 - 2nd Semester - ECE Dept - 2021 Regulation | 2nd Semester ECE Dept 2021 Regulation
Circuit Analysis
EC3251 - 2nd Semester - ECE Dept - 2021 Regulation | 2nd Semester ECE Dept 2021 Regulation
Materials Science
PH3251 2nd semester Mechanical Dept | 2021 Regulation | 2nd Semester Mechanical Dept 2021 Regulation
Basic Electrical and Electronics Engineering
BE3251 2nd semester Mechanical Dept | 2021 Regulation | 2nd Semester Mechanical Dept 2021 Regulation
Physics for Civil Engineering
PH3201 2021 Regulation | 2nd Semester Civil Dept 2021 Regulation
Basic Electrical, Electronics and Instrumentation Engineering
BE3252 2021 Regulation | 2nd Semester Civil Dept 2021 Regulation
Physics for Information Science
PH3256 2nd Semester CSE Dept | 2021 Regulation | 2nd Semester CSE Dept 2021 Regulation
Basic Electrical and Electronics Engineering
BE3251 2nd Semester CSE Dept 2021 | Regulation | 2nd Semester CSE Dept 2021 Regulation
Programming in C
CS3251 2nd Semester CSE Dept 2021 | Regulation | 2nd Semester CSE Dept 2021 Regulation