+ 1
int main or void main..?
Can either of these be used ..? I tried but why doesn't void main work on Sololearn
4 Respostas
+ 3
No need to select 'void main()'. Because, main function should return some return value in order to verify that our code was compiled well by compiling platform.
If main() does't return anything, that compiling platform won't give any guarantee that program was compiled perfectly.
+ 5
In modern compiler from the new c++ standards, if required main return type should be int. But in old compilers it was void.
Edit:
This may help for clarity....
https://stackoverflow.com/questions/204476/what-should-main-return-in-c-and-c
0
Void : non returnable datatype, your need to print the outcome.
Int:-returnable datatype ,it will return outcome as such.