① The Compilation Process of C Language.c files are transformed into executable files through four stages: preprocessing, compilation, assembly, and linking.(1) Preprocessing: Includes header file inclusion, macro replacement, conditional compilation, and comment removal.(2) Compilation: The C language is translated into assembly, outputting a .s assembly file;(3) Assembly: The assembly file is translated into binary, outputting a .o binary file;(4) Linking: Links library files, outputting the executable program.② What is the difference between typedef and #define naming?#define is a preprocessing directive used for text replacement before compilation, with no syntax checking.typedef is commonly used to create aliases for structures and enumerations, while #define is often used to define constants.③ What is the difference between #define and const for defining constants? What are the advantages of const over #define?#define is a simple text replacement that occurs during the program preprocessing phase, occupying code segment space and having no scope limitations. In contrast, the const keyword is a type modifier that operates during the program compilation and runtime phases, occupying .data segment space.Advantages: Syntax checking is performed; it can be debugged.④ What are the four memory allocation areas and what do they store?After compilation and execution, C code occupies memory primarily divided into four areas, from low to high addresses: code area, global area, heap area, and stack area.(1) Code area: Stores binary executable code and is read-only.(2) Global area: Stores global variables, static variables, and constants. Depending on initialization, it is specifically divided into: .bss segment: Stores uninitialized/global variables and static variables initialized to 0 .data segment: (data segment) Stores initialized global variables, static variables, and constants(3) Heap area: Used for dynamic memory allocation. Managed by the programmer for allocation and deallocation.(4) Stack area: Stores function parameters, local variables, etc., automatically managed by the compiler.⑤ What is a memory leak?(1) Definition: Memory that is dynamically allocated on the heap is not released. This leads to increasing memory usage during program execution, causing performance degradation or even program crashes.(2) Causes: Forgetting to release memory.(3) How to avoid:1. For every malloc, there must be a free; whoever allocates must release.2. Use logging for tracking. Each time memory is allocated, print the line number and pointer address, and do the same when releasing memory. If the number of allocations exceeds the number of releases, it can be determined that a memory leak exists. Logs can help locate the issue.⑥ Constant pointers and pointer constants* and const indicate which comes first, the one that cannot be changed. const int *p int *const p* symbolizes the address, const symbolizes the data; the one that comes first cannot be changed.Constant pointer: The data pointed to by the pointer is constant, but the address stored by the pointer can change.Pointer constant: The address stored by the pointer is constant, but the data at that address can change.⑦ Memory alignment and byte alignment(1) DefinitionWhen the CPU accesses memory, the byte size read at once is usually equal to its machine word size. Arranging data in memory in a way that is convenient for the CPU to process is called byte alignment. In a 32-bit system, for a 4-byte data, its starting address is best a multiple of 4, allowing complete access to the data in one operation.Memory alignment improves access efficiency but increases memory usage, trading space for time.The alignment method of the same structure may differ across different compilers or settings, which can lead to code that works correctly on one platform failing on another.(2) Alignment values1. The inherent alignment values of basic data typesIn a 32-bit system, 1 byte: char; 2 bytes: short; 4 bytes: int, float, long; 8 bytes: double2. The inherent alignment value of structuresThe largest inherent alignment value among the structure members.3. Specified alignment valuesAlignment values specified by the program.#pragma pack(value)