if i use exit(); in my code it throws and undefined function erro f i pass any int value as aparameter to it it excepts it
ie exit() fais to work
exit(0), exit(1) exit(998) all work
what is the significance of the parameter? and why is it needed/
if i use exit(); in my code it throws and undefined function erro f i pass any int value as aparameter to it it excepts it
ie exit() fais to work
exit(0), exit(1) exit(998) all work
what is the significance of the parameter? and why is it needed/
Monday - what a way to spend a seventh of your life
That is the value that gets returned to the operating system.
at the end of main you have return 0, but if you use the exit function, you skip that return statement, but you need to return a value because the os is expecting one.
What ever you pass to exit will be returned to the os.
when i use return and exit(x), they return values - i undersatnd that the ones to use are 1 and 0 indicating error and success respectivly. So how does the os (windows in my case) respond. I have never seen it take action as a result of adjusting the return value.
Monday - what a way to spend a seventh of your life
it may be in the transparent disposal of the programs used resources, im not sure.
ADVISORY: This users posts are rated CP-MA, for Mature Audiences only.
maybe its because this is c++ and the function is prototyped like this.....
void exit(int);
therefore a call to exit() will result in a function not found error.
Free the weed!! Class B to class C is not good enough!!
And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi