voidmain(){...} is not in the standard, but works on both MSVC and GCC (with warnings). I think it works on both C/C++, but you really shouldn’t use it in production. Just use intmain(void){...} , without any return value, which is permitted in the standard, and will return success iirc.
That is why I use just
int main(){...}
without arguments instead.Any
void main(){...}
enjoyers?besides not requiring a return value, what difference does it make?
@stebo02 @Bogus5553 Neither of them require a return value, but
void main
isn’t legal C++.yeah I thought so, does it work in C?
void main(){...}
is not in the standard, but works on both MSVC and GCC (with warnings). I think it works on both C/C++, but you really shouldn’t use it in production. Just useint main(void){...}
, without any return value, which is permitted in the standard, and will return success iirc.It will also give an error if you try to add a return value anyways.
int main(void) { . . . }
for me!while (true) {...}
Very true, the less user input you have the safer your code will be.