Computing.Net > Forums > Programming > what is the meaning of return 0;?

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

what is the meaning of return 0;?

Reply to Message Icon

Name: moldman
Date: February 26, 2003 at 05:56:34 Pacific
OS: Windows 2000
CPU/Ram: 256Mb
Comment:

Hi everyone,

I am a high school student and will take c programming later on.

Please tell me:
1. what is the meaning of "return 0;"? When will use it?

2. How to declare a variable that stores only positive integer values?

Regards,
Moldman



Sponsored Link
Ads by Google

Response Number 1
Name: Lightning
Date: February 26, 2003 at 08:08:15 Pacific
Reply:

Typically, return 0 is used to terminate the main function of a C program - after having initialized it as int main(int argc, char argv)

This is done so that you can pass parameters into the program, and to return values from the program. Typically, a return value of 0 means that the program finished correctly, and 1 (or any other integer value) means the the program finished with an error.

To store only integer values in a variable it must be declared as unsigned. All the major numerical data types can be declared as unsigned; short, int, long, etc...

Hope this helps, GL with the class.


0

Response Number 2
Name: moldman
Date: February 26, 2003 at 15:39:00 Pacific
Reply:

Thanks a lot, lightning!


0

Response Number 3
Name: Lightning
Date: February 26, 2003 at 22:54:49 Pacific
Reply:

you're welcome,

glad I could help :)


0

Response Number 4
Name: Lightning
Date: February 27, 2003 at 15:46:36 Pacific
Reply:

Sorry, I need to clarify my first answer.

When I said: "To store only integer values in a variable it must be declared as unsigned. All the major numerical data types can be declared as unsigned; short, int, long, etc..."

I SHOULD have said: "To store only POSITIVE values in a variable it must be declared as unsigned. All the major numerical data types can be declared as unsigned; short, int, long, etc..."


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: what is the meaning of return 0;?

what is the meaning of 1nul or 2nul www.computing.net/answers/programming/what-is-the-meaning-of-1nul-or-2nul-/19101.html

what is the name of the software www.computing.net/answers/programming/what-is-the-name-of-the-software/13798.html

? in c++...what is this? www.computing.net/answers/programming/-in-cwhat-is-this/3311.html