What is difference between int main and void main how it works and what is use of return value in c language | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is difference between int main and void main how it works and what is use of return value in c language

14th Aug 2019, 6:54 AM
Balaji
Balaji - avatar
2 Answers
+ 7
Take a look at the thread comments here by Shadow and the referenced links within that thread: https://code.sololearn.com/cAwY3si7Udbw/?ref=app Her initial response was: "You might not 'need' the return value right now, nonetheless void main() is not correct C++ according to the standard."
14th Aug 2019, 7:18 AM
David Carroll
David Carroll - avatar
+ 1
int main means at the end of main it should return a integer value, so at last line in main function we write return 0 Void main means at end of main, it should not return any value, so we don't use return. We cab use getch(); for void main
23rd Aug 2019, 6:16 PM
Mohammad Tarique Hussain
Mohammad Tarique Hussain - avatar