I. The process of generating executable files from source files
The process of generating an executable file from a. C source file is divided into four steps:
1, precompiled Processing: The command is to use GCC-E, this step is mainly to "#" The beginning of the command processing, delete comments, etc., these commands such as #define, #ifndef, #endif等等;
2, compile Stage: command is to use gcc-s, this step is mainly to do grammar check, and generate assembly instructions (code optimization and other operations also in this step, this phase takes a long time);
3, assembly stage: The command is used Gcc-c, the main task of this step is to use the assembly code generated in the previous step to generate the target file (. o or. obj);
4, Link stage: The command can use GCC, you can also use the LD linker, the main task is to link the source files generated by the target file to form an executable file.
Second, the concept of memory
Memory, which is the internal memory, is made up of storage units. It is characterized by a linear continuous storage unit. The minimum unit of storage unit is bytes.
Each byte has its own independent address. The current memory generally requires four-byte alignment.
The concept of an address:
In order to access a storage unit in memory, we need to number it, which is called the memory address. Through the address we are able to access the storage unit identified by the address.
Variables and constants:
Under the instructions of the program, the computer can do a lot of things: numerical calculations, sorting names, calculating comet orbits, preparing mailing lists, and so on. To accomplish these tasks, the program needs to use the data, which is the number and character that hosts the information.
Some data can be pre-programmed before the program is used and will not change throughout the run, such data is called a constant. Constants are also divided into direct constants and symbolic constants
Additional data can be changed or assigned during the program's operation, and such data is called a variable.
C Related Base points