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

where the main return value of main is stored.

P: 1
if we use the following program

int main()
/* some code */

once the program completes its exicution the 1 is returned.

my doubt is where this return value is stored ? and how it can be seen.

kindly send mail if u know answer.

my id is

removed per posting guidelines

Jun 18 '07 #1
Share this Question
Share on Google+
1 Reply

Expert Mod 5K+
P: 9,197
The return value from main() is the final result of your program.

The operating system can make this available so you can execute your program using a script language and be able to (within that script) check the return from the program to determine what to do next in the script.

You can't see this in C/C++.

BTW: By custom: 0 == SUCCESS. All other values indicate some sort of failure.
Jun 18 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.