简体   繁体   中英

Including header files in middle of a c++ program

Is it possible to include a header file in the middle of the code in a c++ program? I mean i wanted to include a header file "cstdlib" in the middle of a program.

It is possible to use the #include preprocessor directive anywhere in your code. However, all it does is that it adds the content of the file you are including instead of the directive. So it would not make sense to #include an external library in the middle of a function.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM