Hello world C++ program problem

Started by
54 comments, last by WaterMelon34 21 years ago
Yes! IT WORKS! YAY! Thanks alot guys
Advertisement
All I had to do was uninstall the other compiler and redownload Dev-Cpp
A three page thread on a Hello World application... What is the world coming to?
quote:Original post by Drevay
The reason you got an error is because you forgot to put return 0; inside of your program. You always have to return a value when using int main() , and since you didn''t, the compiler get''s ''confused''.

No, no, no. main() certainly has to return an integer value, but like I already said, you do not have to do this explicitly - in C++, main() implicitly returns 0 unless otherwise specified. It certainly doesn''t hurt to do it explicitly, but on the other hand, I see no compelling reason to do so.
Well, of course using return 0; when no other value has to be returned...is just good programming practice. (IMO)

DigiCode - My solo company in progress
_________________Politics is the ability to foretell what is going to happen tomorrow, next week, next month and next year. And to have the ability afterwards to explain why it didn't happen. -- Winston ChurchillGDNet-0.2 - rate users the easy way with this nifty Firefox extension. Updated with new features.
Well, that is a valid point of view. I just hate to think that people go around thinking you can''t live without it. My own way to look at it differs slightly from that: If main() never returns anything other than 0, the return value is meaningless, so I see little point in returning anything explicitly.

This topic is closed to new replies.

Advertisement