How a C++ program works?

The code in C language undergoes these steps before execution.
Working steps of C

1. Source Program: This is the code you write in the C compiler. When the Compile button is clicked, a ‘.c’ or ‘.cpp’ file(whatever the language is used) is made.

2. Preprocessor: After the .c/cpp file is created, the preprocessor phase is executed. The preprocessor processes the preprocessor statements( the statements preceded by a hash<#> sign) and removes the comments that are based just for documentation. A preprocessed file is created after this step.

3. Compilation: In this phase, the syntax of the program is checked. If there is any compilation or syntax error, that is reported in this phase. After this phase, a .obj (object file is created).

4. Linking: A linker links the code of the accessed library functions or other functions used in the code with the program. An executable image of the program is made in this step.

5. Loading: Loading is putting the program into the memory for execution.

6. Executable File: An executable file is created in this step. If Run command is given, this file is executed.

kaliadevansh has written 15 articles

One thought on “How a C++ program works?

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>