0
Anybody can tell me the difference between the "return 0" and "return 1"with example
5 Answers
+ 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 error forced your program to terminate without fulfilling its intended purpose.
It's unusual that your example returns 0 (normal termination) when it seems to have run out of memory.
status 0 means the program succeeded.
status different from 0 means the program exited due to error or anomaly.
+ 1
 return 1 means that program is return error .
0
Aur " return 1 "means
0
You means that if we write "retun 0" then the program run otherwise we use "return 1" then the program having error
0
#include <stdio.h>
int main() {
int count = 1;
while (count < 8) {
printf("Count = %d\n", count++);
;
}
return 1;
}
//the program excutes