Home  >  Article  >  Backend Development  >  How is a C program executed?

How is a C program executed?

王林
王林forward
2023-08-28 11:57:051475browse

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!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete

Related articles

See more