Where should we use int main() and where void main() | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Where should we use int main() and where void main()

8th Dec 2016, 11:14 AM
Ravi Kumar
Ravi Kumar - avatar
2 Answers
+ 1
The int or void is the function return type. If your function needs to return an integer, use int .
8th Dec 2016, 12:51 PM
Rishi Anand
Rishi Anand - avatar
0
by default it's int by compiler if there is no return type specified like this main(){ cout <<"hello"; return 0; }
8th Dec 2016, 1:46 PM
Vipul Walia
Vipul Walia - avatar