Possible Duplicate:
What is the proper declaration of main?
A little while ago I took a course on c++ algorithms. We used visual studio in the classroom and sometimes when writing the main function we would declare it void main() { as opposed to int main(){return 0;} . This worked fine although I knew it normally you should use int. Just recently I tried compiling the same code from the class in netbeans in linux. This time, it would not accept the main function to be declared void. Why is it that the g++ compiler requires the main function to be declared an int? Sorry if this is a silly question.
The standard says that it needs to be
int main()(emphasis here on the return type, not the arguments).void main()is not standard, and as such bound to break on various platforms.