Sunday, November 14, 2010

What is difference between void main() and main() and main(void) in c/c++?

Every function has a default return type as int .void main () ensures that the main function does not return anything.Void main,void means doesn't return anything.void is a garbage collection of values.The default return type will be int.

  • void main() - It will not return anything.
  • main() - It will return a value of type int.
  • main(void) - It will return a value of type int without taking any arguments.

No comments: