----- Original Message ----- From: "peternilsson42" <peternilsso...@yahoo.com> To: <c-prog@yahoogroups.com> Sent: Tuesday, April 07, 2009 6:33 PM Subject: [c-prog] Re: C language
> From: "roshni anju" <roshni_a...@...> > > Is there anyone who can plz tell me What does Main() > > function return by default in 'C' Language. A hosted implementation is required to support at least two forms of main: int main(void) int main(int, char **) Or int main(int argc,char* argv[]) most of the time. Portable return values are 0, EXIT_SUCCESS and EXIT_FAILURE, the latter two being declared in <stdlib.h>. In C++ and C99, 'falling off' main, e.g. int main() { /* no return */ } ... will result in a default of 0 being returned. C90 says that if the initial call to main fails to return a value, then an unspecified termination status will be returned to the host. A free standing implementation need not even start via a function called main. "Bill Cunningham" <bill...@...> wrote: > It can return either an int or nothing. In other words > void. > > void main(void) I'm sure you've read otherwise Bill, and chosen to ignore it... <http://www.parashift.com/c++-faq-lite/newbie.html#faq-29.3> <http://c-faq.com/ansi/voidmainbooks.html> <http://c-faq.com/~scs/readings/voidmain.960823.html> Honestly this is the first time I've read this. I've been told otherwise and I guess I was wrong. I seldom read the clc FAQS so that's my loss.