Goonigooguu wrote:[color=blue]
> Thanks all. Bloodsheds Dev-C++ works just fine but I do have other question.
> Usually is start my main() as follows without a return:[/color]
1. Don't top-post. Replies are either interspersed or appended
at the bottom.
[color=blue]
> void main()
> {
> //code body
> }
>
> This causes a problem with Dev-C++ and I have to use:
> int main()
> {
> //code body
> system("PAUSE")
> return 0;
> }
>
> Is this a problem or normal. Please explain in laymans terms. Thanks.[/color]
As stated many times in this newsgroup and news:comp.lang.c,
the main() function returns an int. Always. No exception.
Anything else provokes undefined behavior. As to what normal
is, that is a misleading term.
The correct form for a minimalist C++ program is:
int main()
{
}
According to the standard, the main() function is the only
function that has a default return value. Constructors
are special functions that don't return values. Better
form for the main function is:
int main(void) // or (int, char **)
{
return EXIT_SUCCESS; // or EXIT_FAILURE
}
Read the FAQ and welcome.txt via the links below.
--
Thomas Matthews
C++ newsgroup welcome message:
http://www.slack.net/~shiva/welcome.txt
C++ Faq:
http://www.parashift.com/c++-faq-lite
C Faq:
http://www.eskimo.com/~scs/c-faq/top.html
alt.comp.lang.learn.c-c++ faq:
http://www.raos.demon.uk/acllc-c++/faq.html
Other sites:
http://www.josuttis.com -- C++ STL Library book