(a *.c files
(b Contain function definitions
(a *.h files
(b Contain function declarations (function prototypes)
(c Contain various preprocessor statements
(d Allow source code files to access externally-defined functions
(a *.o files (or *.obj on Windows)
(b The output of the compiler
(c Contain function definitions in binary form
(d Not executable by themselves
(a No suffix on macOS or Unix OS (*.exe on Windows)
(b The output of the Linker
(c Made from (a few) object files
(d Can be directly executed
(Before the C compiler starts compiling a source code file, the file is processed by the preprocessor)
>> It is invoked automatically by the compiler before compilation proper begins.
>> It converts source code (*.c) files, which may exist as a real file or be stored in memory for a short time before being sent to the Compiler.
>> Preprocessor commands start with “#”
For example : #include #define #undef #ifdef #ifundef #error #if #else #elif #endif #pragma
>> #include
C compilers do not allow using a function unless it has previously been declared or defined in the file.
#include statements are thus the way to re-use previously written code in C programs ( like printf 这种,他的declared就在stdio.h文件里)
>> #define
To include header files, which mainly contain function declarations and #define statements, e.g.,
It turns the source code into an object code file, which contains the binary version of the source code (not executableyet).
It links together object files (.o files) into a binary executable.
• It is a separate program called ld.
• It is invoked automatically when using the Compiler.
% gcc foo.o bar.o baz.o –o myprogram
This tells the compiler to link together 3 object files (foo.o, bar.o and baz.o) into a binary executable file named myprogram. 这个myprogram就是可以run的
% ./myprogram
• The main ( ) function
• Statements
• C Skeleton
• Identifiers
• Keywords
• Basic data variables and types
• Constants
1. "main” is a C keyword. We must not use it for any other variable.
2. Good programming practice tells us that we should not ourselves call Main() in our code.
1. Integers : char / int / short / long / long long
2. Unsigned integers
3. Floating point numbers : float / double
4. Chars : Numeric digits: 0 – 9 / Letters: a – z and A – Z / Space (blank) / Special characters: !@£$%^&*()