This may be a dumb question. But is it possible to use multiple files in a single program without using header files concept. Perhaps maybe using the "extern" keyword.

Recommended Answers

All 4 Replies

Yes, you can do that. The problem is that you are doing double the work that is necessary, and its very easy to make mistakes in the extern statements between the different files. If you only have one or two variables/functions you want to declare extern then by all means just put the statement at the top of the *.cpp files that need them.

Any tutorials for more info?

why do you need a whole tutorial just to declare an object with the extern keyboard? Its pretty trivel to code. Just put this near the top of the *.cpp file. extern int something;

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.