+ 7

Void or Int

Is it a better practice to use void main() more often instead of int main() ?

18th Jun 2017, 5:42 PM
Ritesh Behera
Ritesh Behera - avatar
6 Answers
+ 9
In latest C++ standards, main() must return int so void main() isn't really an option.
19th Jun 2017, 4:08 AM
Hatsy Rei
Hatsy Rei - avatar
+ 8
int main(). void main() might not even work for all compilers. It's also a standard for C, so there's really no point in getting into the habbit of making it void.
18th Jun 2017, 5:55 PM
Rrestoring faith
Rrestoring faith - avatar
+ 5
Thank you guys I got it cleared.
19th Jun 2017, 12:06 AM
Ritesh Behera
Ritesh Behera - avatar
+ 3
int for usual
18th Jun 2017, 5:53 PM
FUN HOMSTER :D - avatar
+ 3
Good practicies: int main returns 0 which informs us that program ran successfully ^^ void main returns nothing so we cannot acknowledge if program had error during runtime or not (assuming the error log is off)
18th Jun 2017, 9:16 PM
Jakub Stasiak
Jakub Stasiak - avatar
+ 1
Always use int main
22nd Nov 2017, 10:57 PM
Kalen Jones
Kalen Jones - avatar