Difference between using ‘void main()’ and ‘int main()’
There is a huge difference between the two apart from their returning types (in C) First and foremost, void main() is wrong. Though it may seem to work on some platforms, it should not be used. The question is why. 1st Reason: Because under the C99 standard, only these two are acceptable. 1 2 int main (void) int main (int argc, char *argv) 2nd Reason: Because you may return a garbage value to the invocation environment which is not good if someone wants to find if the program terminated correctly. A return 0 statement used in the case of int main() says that the program properly terminated. I strongly recommend that you stick to the standard and use int main(void); as the prototype for main.