0

Anybody can tell me the difference between the "return 0" and "return 1"with example

15th Dec 2019, 4:06 AM
Hunter Rokko
Hunter Rokko - avatar
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.
15th Dec 2019, 4:15 AM
Prathvi
Prathvi - avatar
+ 1
 return 1 means that program is return error .
15th Dec 2019, 5:15 AM
Prathvi
Prathvi - avatar
0
Aur " return 1 "means
15th Dec 2019, 5:06 AM
Hunter Rokko
Hunter Rokko - avatar
0
You means that if we write "retun 0" then the program run otherwise we use "return 1" then the program having error
15th Dec 2019, 5:22 AM
Hunter Rokko
Hunter Rokko - avatar
0
#include <stdio.h> int main() { int count = 1; while (count < 8) { printf("Count = %d\n", count++); ; } return 1; } //the program excutes
15th Dec 2019, 5:26 AM
Hunter Rokko
Hunter Rokko - avatar