Why do all the C files written by my lecturer start with a single # on the first line?

后端 未结 3 1139
面向向阳花
面向向阳花 2020-12-22 14:52

I\'m going through some C course notes, and every C program source file begins with a single # on the first line of the program.

Then there are

3条回答
  •  清歌不尽
    2020-12-22 15:37

    You need to know about the Compilation process of C. Because that is "must know" how the Source code converting into Executable binary code (file).

    From the Compilation Process, the C source code has to Cross the pre-processor Section. But how to tell the Compiler to pre-process the code?... That the time # Symbol was introduced to the indicator of Preprocess to the compiler.

    For Example #define PI 3.141 is in the Source code. Then it will be change after the Preprocessing session. Means, all the PI will be changed into 3.141.

    This like #include , the standard I/O Functions will be added into your Source code.

    If you have a Linux machine, compile like gcc -save-temps source_code.c. And see the compiler outputs.

提交回复
热议问题