Which of the following is the correct value returned to the operating system upon the successful completion of a program ?
UGC NET - 2014,
Answer: A
The value 0 is returned to the operating system when a program completes successfully. By convention a return value of zero from main, or a call exit(0), means success, and a non-zero value means some kind of error. The values 1 and -1 are used for failure, and a program does return a value, since the operating system looks at it. Shell scripts and make files test this value to decide whether the program ran correctly.
Please log in or register to report this question.