C Program Execution Phases
First of all execution or executing a program refers that we are now checking program for errors and then for output.
C program basically goes under 6 phases for execution:
1) edit 2) preprocess 3) compile
4) link 5) load 6) execute
1) Edit: In this C program execution phase a programmer edit(type) a program with an editor program. We basically have sea of bodland in Windows operating system which is console based that is output comes on black screen. Now we also have Microsoft Visual Studio.
2 ) Preprocess: In this C preprocessor executes before a program is compiled. It performs some actions like a) inclusion of other files in the file being compiled. b) symbolic constants and micros c) conditional compilation of program codes. d) conditional execution of preprocessor directories.
3) Compiling: In Phase 3 compiler translate the C program into machine language code. It issues an error message to locate and fix the incorrect statements that means compiler issues and error when it does not recognise the syntax of code because when a statement is not as per according to the rules of the language. Syntax error are also called compile errors or compile time errors.
4) Linking: C program basically contains reference to function defined elsewhere such as in the standard libraries or private libraries of group of programmers working on a particular project. Object code produced by c compiler typically contains "HOLES" due to this missing parts. So Linker links the object code with standard libraries or missing codes to produce an executable image.
5) Loading: Before a program can be executed, the program has to be placed in memory. This is done by 'loader' which takes the executable image from disc and transfer it to memory.
6) Execution: After all phases the execution phase comes in this phase CPU that is central Processing Unit execute the program one instruction at a time and the output of that code is printed on the monitor screen of the computer.