The difference, quite obviously, is the definition of main .
In the first version, the function is defined as void main() . Therefore, it does not return anything. Furthermore, it takes an infinite number of arguments.
The second version has the function defined as int main(void) . It returns an int value and takes no arguments. The return statement, return 0; , informs the operating system that the program has ended with no errors.
The first version is considered to be bad practice, so you should get in the habit of using the second version.
and main() is also function in c/c++ , and must have following three thing.
But in our program we just declare the body of main() function.
Now come to your problem
In the first version, the function is defined as void main(), which means it doesn't return any thing and doesn't take any arguments.
Second one return one integer value and take no argument.
Both are correct and have no problem at all.
Best of Luck.