c++ include
时间: 2023-11-03 18:22:22 浏览: 45
#include is a preprocessor directive in the C programming language. It is used to include the contents of another file into the current file being compiled. This allows for code reuse and modularity in C programs.
For example, if you have a file called "header.h" that contains function declarations or variable definitions, you can include it in your main C file using the #include directive like this:
```c
#include "header.h"
```
This will make the contents of "header.h" available in your main file, so you can use the functions or variables defined in it.
There are two types of include statements:
1. `#include <header>`: This form is used for standard library headers. It searches for the header file in the standard system include directories.
2. `#include "header"`: This form is used for user-defined headers. It searches for the header file in the current directory or the directories specified by the -I compiler option.
Please let me know if you have any more questions related to C programming!