+ 3

Why should we use int main only why not void main

30th May 2017, 5:33 PM
Himanshu Agarwal
Himanshu Agarwal - avatar
7 Antworten
+ 6
tl;dr - As of the latest standard in C++, main() must return int.
30th May 2017, 6:13 PM
Hatsy Rei
Hatsy Rei - avatar
+ 4
A reason as to why you would wish to use void main() would be helpful for us to give you appropriate pieces of advice.
31st May 2017, 12:31 AM
STAPS Guru
STAPS Guru - avatar
+ 2
This questiom has been asked a million times. Try searching on google on use the search bar on here 🌏
30th May 2017, 6:12 PM
aklex
aklex - avatar
+ 1
u can use void but don't return anything
30th May 2017, 6:39 PM
Abdelrhman Elsaid
Abdelrhman Elsaid - avatar
0
ohkie thanks and is this app good enough to understand full c++ rather than going to.a coaching
30th May 2017, 6:14 PM
Himanshu Agarwal
Himanshu Agarwal - avatar
0
The main program that is running eventually should return an integer value, according to whether the program worked out without problems or not. For example, when your program terminates itself without problem it finally returns "0". See here for more detailed answer: https://stackoverflow.com/questions/449851/why-do-we-need-to-use-int-main-and-not-void-main-in-c
30th May 2017, 6:14 PM
Hakki Riza Kucuk
Hakki Riza Kucuk - avatar
0
the c++ standards need​s int main() which means you can use any exit status. while visual c++ is offering you void main() it has default exit status as 0
30th May 2017, 9:45 PM
MR Programmer
MR Programmer - avatar