There is a slight difference between an explicit
void and nothing at all, like Ben Lynn said:
"The declaration:
void some_function();
In C, it declares a function with an unknown number of arguments, while in C++, it declares a function with zero arguments."
(http://www-cs-students.stanford.edu/~blynn/c/ch07.html)
About main's parameters...
Like Mathhead200 said above, those arguments are the parameters passed by command line at execution. When you do a program, you get your working data on different ways (interactively from user, from a file, or hard-coded, and in a bunch of other different ways...)! Among them, parameters are yet another very useful way to pass data to a main executing module. I'll give you a tangible example: I see you almost everyone have Windows so let it be "notepad.exe" - the Windows's elementary text editor. You may open a file either after opening the Notepad's window then by menus or dragging and dropping the desired file in it's window, or... you may write in the "Command Prompt":
notepad.exe file.txt
In this way Notepad's main function will receive "argc" with value 2 (nr. of parameters), and "argv" would be the array of those two string parameters: "notepad.exe" and "file.txt". Notepad receive in this way the name of the file you want it open and I guess that if you tried to type that in your console, the result is visible. It will open the "file.txt" if there is such file in the current active directory, or prompt you asking if you want to create it if it doesn't exist! In such maner you may write your own program:
1 2 3 4 5 6
|
#include "stdio.h"
void main (int n, char* s[])
{
if (n > 1)
printf("Hello, %s!", s[1]);
}
|
...that do some wonders out there! ;)