can some pro quickly explain what's the use of extern keyword?
sometimes i see a function declared as:
extern int myFunc();
what does the extern do there?
can some pro quickly explain what's the use of extern keyword?
sometimes i see a function declared as:
extern int myFunc();
what does the extern do there?
7. It is easier to write an incorrect program than understand a correct one.
40. There are two ways to write error-free programs; only the third one works.*
It is redundant and not necessary (for function prototypes, as in your case).
The only reason you would be using extern is if you were using global variables across modules. And global variables, as most people agree, are a bad thing, so if you see the word "extern" you should probably be thinking "bad code," or at least code that could be improved.
EDIT: Of course, there is the extern "C" thing, but that's just the extern keyword hacked into a new role. If you aren't calling C code from C++ code, there is no need for it.