473,406 Members | 2,369 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

what is the difference between exit(1) & exit (-1) ?

what is the difference between exit(1) & exit (-1) ?
Oct 11 '10 #1
1 1733
weaknessforcats
9,208 Expert Mod 8TB
The exit() library function has only two possible returns: success (typically 0) and failure (typically 1).

Any other return values are non-standard and depend upon a particular implementation of the OS.

Avoid all hard-ced values in your code. You should be using :

Expand|Select|Wrap|Line Numbers
  1. exit(EXIT_SUCCESS);
or

Expand|Select|Wrap|Line Numbers
  1. exit(EXIT_FAILURE);
Oct 11 '10 #2

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

Similar topics

2
by: fwee | last post by:
What is the difference between using exit(n) and return n in main(), if any? I know that exit(n) is a function that exits and return n exits via a return value, but is there any reason to specify...
5
by: QQ | last post by:
I know there are many functions that I can exit the program such as return 0, exit(0), exit(1),_EXIT(0) .... What are the difference between them? Thanks a lot!
3
by: Sunny | last post by:
Hi, Well this might look like a dumb question to 99.99% of u but what exactly is K&R2 and where can I get it? Secondly alot of people say that you can learn by reading good books on C. I know...
4
by: Joel | last post by:
Run this method: public void test() { bool b; int i=0; b=false; i=0; b=(b && i++==1);
15
by: Brett | last post by:
C# code automatically generates or references. Single or Multi apartment threads. What exacty does this do and what will happen if I remove it? Is MTAThread necessary if I want to use...
3
by: oktave | last post by:
Hi, Anybody would like to tell me ther defference between Application.Exit() and End? I can use End to end my application no matter how many forms and codes after the End statement. But since...
6
by: MilanB | last post by:
Hello What "0&" means in this function call? ret = InternetQueryOption(0&, INTERNET_OPTION_CONNECTED_STATE, _ ci, ci_len) Thanks Milan
6
by: Vicky | last post by:
Please tell me at vdkhakhkhar@gmail.com
11
by: dhan | last post by:
please give answer
1
by: sandeep kumar shah | last post by:
Hi friends, I have a problem while parsing an xml file. When the value of an attribute contains �D; it gives error but when we use 
 it's ok.. Could anyone plz tell me what is the difference...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.