Hi,
I am fairly new to C++ but i would like to know the difference between Int Main and Void Main. I know those are functions but whats the difference
Thanks,
Ahmer
4 Replies - 170 Views - Last Post: 09 January 2013 - 09:07 AM
#1
Whats the difference between int main and void main?
Posted 09 January 2013 - 08:43 AM
Replies To: Whats the difference between int main and void main?
#2
Re: Whats the difference between int main and void main?
Posted 09 January 2013 - 09:03 AM
One is standard the other isn't. Just stick with int main().
#3
Re: Whats the difference between int main and void main?
Posted 09 January 2013 - 09:04 AM
int main will return an integer, void main will not. You should use the int version, and return 0 when the program executes successfully. That will tell the system as much, and it'll interpret any other value (like 1) as if an error has occurred during the program execution.
#4
Re: Whats the difference between int main and void main?
Posted 09 January 2013 - 09:06 AM
Technically speaking, in C++, a return 0 from main is not required, if it is omitted, the compiler will put it there for you.
#5
Re: Whats the difference between int main and void main?
Posted 09 January 2013 - 09:07 AM
Thanks
Page 1 of 1
|
|

New Topic/Question
Reply




MultiQuote




|