C/C++ header file basics and the use of macros

#include is actually in the preprocessing stage, copy the corresponding same file to the front, in order to prove the rationality, take Hello, World as examples, we run the following command

gcc -E testInclude.c -o testInclude.i

We found that the file has many more lines.

In order to prove this, we implement the simplest header file.

add.h

int add(int a, int b){
	return a+b;
}

Main function

#include "add.h"

int main()
{
	add(3,5);
	return 0;
}

 

Advanced usage of macro definition:

1. DEBUG debug mode output

2. The use and skills of similar templates.

Research in specific projects.

Guess you like

Origin blog.csdn.net/wwxy1995/article/details/113816752