Can't we use void main | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Can't we use void main

Instead of using int main() why can't we use void main() what is the difference

11th Jan 2017, 9:12 AM
hemanthg reddy
hemanthg reddy - avatar
5 Answers
+ 2
u can but then u must write one more command at the end that is." getch()" at least in dosbox it is so..I don't know about this app .. I will test this..👍👍
12th Jan 2017, 10:14 AM
Shivani Singh
Shivani Singh - avatar
+ 1
You can use void as the return type of the main method.
11th Jan 2017, 9:55 AM
Dao
Dao - avatar
+ 1
using void main() means that the main function won't return any value. Using int main() means that the main function will return an integer. Depending on what you aim to do in main () function chose wisely.
11th Jan 2017, 9:59 AM
Mandar Powale
Mandar Powale - avatar
0
Didn't get it
11th Jan 2017, 9:32 AM
hemanthg reddy
hemanthg reddy - avatar
0
yes you can but not on sololearn app
11th Jan 2017, 10:59 AM
Leonida17st
Leonida17st - avatar