English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

i tried to put in a loop as exit(0); it worked. but When i tried to rite exit(7438574)
any thing inside the bracket no change was found but answer showed something like "-ve some integer value"

2006-09-18 02:51:32 · 4 answers · asked by shelke_prithvi 1 in Computers & Internet Programming & Design

4 answers

Look up the exit() function in your compiler's documentation. The exit() function uses an integer value. An integer value for a 16 bit C compiler is between -32768 and 32767.

2006-09-18 03:00:21 · answer #1 · answered by Balk 6 · 0 0

Can you please give us a portion of your code so we can help you
better?
What kind of loop? (for, while, etc)
What programming language?

I guess you are talking about C. Anyway thnigs sould not be very different in other programming languages.

So you have a loop and you want to exit it? Right?
Well.. don't use exit(0) .. this will EXIT YOUR PROGRAM!
Instead try break;

Example (C)

int i=0;
while (1){
i++;
if (i==5)
break;
}

Another thing: please try to avoid infinite loops.
You should give a strong CONDITION for that conditional loop.

Example:

int i=0;
while (i<6){
i++;
}
In this example the loop will exit when the condition (i<6) is false.

2006-09-18 03:03:12 · answer #2 · answered by simpaticool86 2 · 1 0

exit(int) is used to exit the program so anything following the execution of this line will not run.
The integer in the exit function is used to say what error it is. When you have exit(0) it means that that section of code was executed properly and your program will continue running if it was called from another program. If you have anything that's not 0, it means u wanted to exit with an error code, and anything that called this program (supposing it was written correctly) will not execute because you have returned an error code indicating that your piece of code did not execute properly.

2006-09-18 03:11:11 · answer #3 · answered by rice kid 4 · 0 0

Do you know what is it for and in what language are you talking about? C/C++, VB,... ?

2006-09-18 03:00:30 · answer #4 · answered by Andy T 7 · 0 0

fedest.com, questions and answers