+ 2
[DUPLICATE] What is difference between void main() and int main() in c++
differences
9 Answers
+ 5
To add onto what they're saying, it's returning an EXIT STATUS (usually 0 for success, another number for failure) back to the program that called it, which is the Operating System in the case of the main loop. This informs the OS of the program's exit status and can allow it to properly display/handle errors.
+ 2
Though it is standard for the main function to be int main() not void main()
+ 1
One returns something (int) the other does not
+ 1
int main() would have some sort of return like return 0; if it doesnât it will add the previous line of code because itâs a special function. void main() would not have the return statement
+ 1
You can use any function or class in your void main() function but you cannot use a return statement in the function like return 0; or return 500; ect
+ 1
thanks brothers..thanka for help..what i jave learnt in my senior secondary class
0
It's our pleasure, Pranesh. Best of luck to you brother!
- 1
????
- 1
but we we write getch() in void main function