Ankush Banerjee
Ankush Banerjee

Reputation: 1

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.

Upvotes: 0

Views: 674

Answers (1)

Christoph
Christoph

Reputation: 1557

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.

Upvotes: 1

Related Questions