First, for many adorable new programmers, fame and all the functions defined, all placed in a cpp file is more common. The import header files, it can be the difference between the body and the other functions it calls a function, make the program more standardized. Now I will say something about the use of header files, as well as some of the attention point.
1. simple application header file:
First, we create a simple C language function, and write our own import header file. The following is the header file and save way:
The above is our first document, which needs to include the import library functions, macros and function declarations and definitions we have defined. When you save the file header, need to change the file type Header files, as shown below:
Next, we introduced is operated, each function has a main function, which is the entrance of our program. So we have to create a cpp file, import the header file we just created. The following operation is the import header file:
here there is a very problematic place, in use include the import header file, using the presence of <> and distinction for "". We use the best, "" guaranteed to be imported. The difference is as follows:
<> go find a header file system directory, without looking in the current directory. Like the standard header file stdio.h and stdlib.h this and other commonly used methods. The "" first looks in the current directory, if not, then the system directory to find. This used to include self-defined header files, the system uses the current priorities defined in the directory.
Then we just run the code:
this is a simple header files imported. This is also a relatively simple import for large-scale works need to be defined for many functions, create headers can avoid a lot of duplication of work, and header files can be used to share, easy to transplant code and refer to the study.
The above is a simple C language header files. This is the first article I published in csdn, there is a bad place to write, please correct me, thank you.
Importing C header files of language
Guess you like
Origin blog.csdn.net/weixin_44029601/article/details/104873683
Recommended
Ranking