How to Run the Program?
A compiler is needed to turn our code into physical instructions for the processor.
A compiler is a program that converts your code into machine code (binary), that is, into "0" and "1" because only such "commands" are understood by the processor. The compiler doesn't run your code, it only converts it.
The compiler reads the code from top to bottom.
The compilation process consists of several stages:
- Preprocessor work. All
#includedirectives are executed, and third-party files, libraries, etc., are included. In general, everything should be connected to your program;
- Analysis of syntax errors. If the compiler finds a syntax error in your program, the compilation process will stop, and the compiler will indicate an error;
- Everything that was connected to our program is combined and turned into an executable file. For example, in the Windows operating system, executable files have the format ".exe" (executable). After that, you can simply launch it as if you were launching a game on your computer.
Executable file is just a set of instructions (machine codes) for the processor. This is how the text
"Hello, c<>definity"will look in native code: 01001000011001010110110001101100011011110010110000100000011000110011110000111 110011001000110010101100110011010010110111001101001011101000111100100100001.
Don't worry! Only machines have to understand these numbers!
The error was intentionally made to demonstrate the compiler's work.
Let's analyze the error:
Why does the compiler say the error is in the 7th line on the 2nd element if there is nothing there? That's just the point. The compiler expects to see the expression termination character
; there. But why does he expect to see it there and not after
The compiler allows you to put a lot of
;, put up with it.
What are the steps for compiling?
Select the correct answer
Everything was clear?