Quantcast
Channel: Difference between return 1, return 0, return -1 and exit? - Stack Overflow
Browsing all 7 articles
Browse latest View live

Answer by Sunil Yadav for Difference between return 1, return 0, return -1...

To indicate execution status.status 0 means the program succeeded.status different from 0 means the program exited due to error or anomaly.return n; from your main entry function will terminate your...

View Article



Answer by Suvarna Pattayil for Difference between return 1, return 0, return...

As explained here, in the context of main both return and exit do the same thingQ: Why do we need to return or exit? A: To indicate execution status.In your example even if you didnt have return or...

View Article

Answer by Paolo for Difference between return 1, return 0, return -1 and exit?

return from main() is equivalent to exitthe program terminates immediately execution with exit status set as the value passed to return or exitreturn in an inner function (not main) will terminate...

View Article

Answer by EmptyData for Difference between return 1, return 0, return -1 and...

return in function return execution back to caller and exit from function terminates the program.in main function return 0 or exit(0) are same but if you write exit(0) in different function then you...

View Article

Answer by giorashc for Difference between return 1, return 0, return -1 and...

return n from your main entry function will terminate your process and report to the parent process (the one that executed your process) the result of your process. 0 means SUCCESS. Other codes usually...

View Article


Answer by Søren Debois for Difference between return 1, return 0, return -1...

return n from main is equivalent to exit(n).The valid returned is the rest of your program. It's meaning is OS dependent. On unix, 0 means normal termination and non-zero indicates that so form of...

View Article

Difference between return 1, return 0, return -1 and exit?

For example consider following code:int main(int argc,char *argv[]){ int *p,*q; p = (int *)malloc(sizeof(int)*10); q = (int *)malloc(sizeof(int)*10); if (p == 0) { printf("ERROR: Out of memory\n");...

View Article
Browsing all 7 articles
Browse latest View live




Latest Images