+ 1

I don't anderstand ...

why it say is int main..not void main đŸ˜«

10th Jan 2017, 3:54 PM
Lee Noriko
Lee Noriko - avatar
4 Answers
+ 19
int main /////// return 0(It returns 0 to main i.e void) is same as void main
10th Jan 2017, 3:58 PM
Frost
Frost - avatar
+ 2
int or void is a return type with function.
10th Jan 2017, 4:00 PM
Nawaj Shareef
Nawaj Shareef - avatar
+ 2
In previous compilers like Turbo main can be of void type(i.e. not returning anything) but on the other hand in new CPP compilers like GCC and visual c++ main() should return something therefore its data type is preferred as integer and if you don't want the function to return anything you simply pur a return 0 statement as the last one. HappyCoding.
10th Jan 2017, 5:47 PM
Navneet Sharma
Navneet Sharma - avatar
0
It returns an Int so that if your code finishes properly, then it will return a 0, but if there's an error, it will return another number, let's say -1
10th Jan 2017, 4:26 PM
Ignacio Villanueva
Ignacio Villanueva - avatar