+ 2
What is the main difference between void main and int main ? Pls answer my question thank u.
3 Réponses
0
There are not. In C++, the main function is a int, we use it to return if the program works or not (return 0: Ok, all is good, return any other: There is an error). But this is only a convention and this is why a void main function hasn't difference with an int main.
+ 4
in the basically c++ start executing with main() than the int main always return something like we mostly use return 0 but we can take anything else too....where as void there nothing we need to return
+ 2
Void main isnt accepted as valid in C++. Your compiler will quietly tell you to fuck off and it will secretly compile it with main returning a value