Declare variable as exern if initialized in header?
- by Mohit Deshpande
Say I declare a header file with a variable:
int count;
Then in the source file, I want to use count. Do I have to declare it as:
extern int count
Or can I just use it in my source file? All assuming that I have #include "someheader.h". Or should I just declare it in the source file? What is the difference between putting count in the header file vs the source file? Or does it not matter?