Does it matter which way I declare my C++ programs?
The difference is one is the correct way to define main, and the other is not.
And, Yes it does matter.
int main(int argc, char** argv)
or
int main()
is the proper definition of your main per the C++ spec.
void main(int argc, char** argv)
is not and was, IIRC, a pervesity that came with Microsofts C++ compiler.
For C++, only int is allowed. For C, C99 says only int is allowed. The prior standard allowed for a void return.
In short, always int.
You should use int main. Both the C and C++ standards specify that main should return a value.
If you're going by the spec, then you should always declare main as an int.
In reality, though, most compilers will let you get away with either one, so the real difference is if you want / need to return a value to the shell.
The point is, C programs (and C++ the same) always (should?) return a success value or error code, so they should be declared that way.
A long time ago I found this page (void main(void)) which contained many reasons outside of the "the standard says it is not valid" argument. On particular operating systems/architectures it could cause the stack to become corrupted and or other nasty things to happen.
Bjarne Stroustrups made this quite clear:
"The definition void main()
is not and never has been C++, nor has it even been C."