Home > Backend Development > C++ > body text

How is a C program executed?

王林
Release: 2023-08-28 11:57:05
forward
1507 people have browsed it

Here, we will see how the C program is executed in the system. This is basically the compilation process of a C program.

The following figure will show how the C source code is executed.

How is a C program executed?

There are different steps in the above image -

C Code - This is the code you wrote. This code is sent to the preprocessor section.

Preprocessing - In this section, the preprocessor files are connected with our code. We use different header files such as stdio.h, math.h, etc. These files are concatenated with the C source code to produce the final C source code. ('#include', '#define' these are preprocessing directives.)

Compiler - After generating the preprocessed source code, it moves to the compiler and compiles Assembly level code is generated after the entire program.

Assembler - This part takes the assembly level language from the compiler and generates object code, which is very similar to machine code (a set of binary numbers).

Linker - The linker is another important part of the compilation process. It takes the object code and links it with other library files which are not part of our code but it helps in executing the entire program. The linker generates final machine code after linking, ready for execution.

Loader - A program will not be executed until it is loaded into main memory. Loaders help load machine code into RAM and help execute it. When a program is executed, it is called a process. Therefore, a process is (an executing program).

The above is the detailed content of How is a C program executed?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template