By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,885 Members | 1,469 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,885 IT Pros & Developers. It's quick & easy.

main-return ???

P: n/a
what is the ((((return any no;))) in the main mean plz
Ex.
int main()
{

;
;
;
return ??;

}

Mar 2 '06 #1
Share this Question
Share on Google+
5 Replies


P: n/a
# include ha scritto:
what is the ((((return any no;))) in the main mean plz
Ex.
int main()
{

;
;
;
return ??;

}


That's the "exit code".

For example, a "return 0" or "return EXIT_SUCCESS" means that no errors
occured.

You could also google for "exit codes", and see if there's anywhere a
list available (I don't really know, sorry)

Hope this helps,

David

--
Linux Registered User #334216
Get FireFox! >> http://www.spreadfirefox.com/?q=affiliates&id=48183&t=1
Staff >> http://www.debianizzati.org <<
Mar 2 '06 #2

P: n/a

# include wrote:
what is the ((((return any no;))) in the main mean plz
Ex.
int main()
int main(void)

is better, as it spells out your intention.
{

;
;
;
return ??;

}


You should try and make your questions clearer.

My guess is that you want to know how to return a value from `main()`.
As `main()` returns an `int`, you can use any expression that returns
that type (including implicit promotion). E.g. given:

int i = 42;
double x = 42.0;

all of the following are OK:

return 0;
return 37+5;
return i;
return x;
return (int)x;
return EXIT_SUCCESS;
return EXIT_FAILURE;

As for the meaning of the value returned, 0 means success, as well as
EXIT_SUCCESS. You should indicate failure using EXIT_FAILURE. How the
underlying OS (if any) interprets these values is outside the scope of
the C Standard. Both are defined in <stdlib.h>.

Mar 2 '06 #3

P: n/a
"# include" <wa*********@yahoo.com> writes:
what is the ((((return any no;))) in the main mean plz
Ex.
int main()
{

;
;
;
return ??;

}


I'm guessing that "no" means "number", and "plz" means "please". If
you took the time to spell out the words, I wouldn't have to guess.
Abbreviations like that make what you write more difficult to read.

As for the value returned by main, any decent C textbook or tutorial
should answer this elementary question.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Mar 2 '06 #4

P: n/a

"David Paleino" <d.*******@gmail.com> wrote in message
news:du**********@area.cu.mi.it...
# include ha scritto:
what is the ((((return any no;))) in the main mean plz
Ex.
int main()
{

;
;
;
return ??;

}


That's the "exit code".

For example, a "return 0" or "return EXIT_SUCCESS" means that no errors
occured.

You could also google for "exit codes", and see if there's anywhere a
list available (I don't really know, sorry)

A portable program can return 0 (success), EXIT_SUCCESS (success) or
EXIT_FAILURE (terminate without accomplishing intended purpose).

Other codes are platform-dependent.

--
Buy my book 12 Common Atheist Arguments (refuted)
$1.25 download or $6.90 paper, available www.lulu.com
Mar 2 '06 #5

P: n/a
It says that the main function must return a int type code, default 0
indicate successful.
"# include" <wa*********@yahoo.com> ????
news:11**********************@t39g2000cwt.googlegr oups.com...
what is the ((((return any no;))) in the main mean plz
Ex.
int main()
{

;
;
;
return ??;

}

Mar 3 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.