In the 1.C language, the compilation is for a single source file, and the link is for the entire project.
2. The variable definition should not be placed in the header file , otherwise it will cause a link error . The header file should only place the type definition, the declaration of the function, and the declaration of the variable.
3. If you do not add a preprocessing statement such as #ifndef in the header file, you are likely to create a compile-time error with a duplicate type definition.
4. The function declaration in the header file is intended to provide the compiler with a reference to the function prototype, which is not required.
5. The pointer contains dual information:
A) The value of the pointer itself represents the starting position of the pointing memory
b) The type of pointer indicates the size of the unit pointing to the memory.
6.C-language memory does not have a property, and what type of pointer points to it, it explains why the type of data.
7. The key to exchanging two variables is to pass their pointers, such as the T-type pass t* as a parameter.
8. When an array is passed a parameter, a one-dimensional array such as int a[10] , the pass parameter can use int*, if it is a two-dimensional array int a[3][10], then the pointer of one-dimensional array should be passed Int (*a) [10 ].
9. Two-dimensional array int a[10][5], a[i] is equivalent to * (a+i), while a[I [j] is equivalent to * (* (A + i) + j) .
size End problem:TCP Transport, for strings do not need to consider the size of the end, for int , etc. need to consider. In short , there is no need to consider the size side of the data in bytes logical units.
11. The function pointer contains two kinds of information, the first is the memory address of the function, the second is the type information, contains the function's parameter list and the return value. (There is a simple introduction to function pointers in the previous article)
Some common misunderstandings in the C++--c language