Except that C does not have a built in Boolean type (C++ does, but that is a very different language).
You decide what your return codes mean, it is not defined anywhere in the language specifications.
However for main, there are two defined macros for indication of success and failure to a hosted implementation (EXIT_SUCCESS & EXIT_FAILIURE).
Regards, Dan.
2006-08-06 06:27:09
·
answer #1
·
answered by Dan M 3
·
0⤊
0⤋
The return[value] is just doing as it says: returning a value to the routine that called it.
You have two ways of "returning" (replying) things: True or false, or a value.
example 1:
boolean myroutine(a, b) {if a = b return true, else return false}
if a = b, the routine "returns" true to the calling routine. If not, it returns false.
Usually, "0" is false, "1", "-1" are true (or any other number than 0 is "true" if your routine is defined as returning a boolean.
example 2:
integer myroutine (a, b)
{ z = a + b; return(z) }
when calling myroutine(), it adds a and b and returns an integer (the sum).
2006-08-05 23:17:12
·
answer #2
·
answered by just "JR" 7
·
0⤊
0⤋
go back 0 tells Unix, "This software exited generally. no longer something to do the following." go back a million says, "Unix, we've a situation." C and Unix were born and grew up jointly. both are woven deeply into each others' infrasctructures and also you'll study Unix or Linux better actual in case you comprehend C. C++ is now better than only a superset of C yet we nonetheless have a tendency to apply the same compilers for both and if you're a respectable C++ programmer you probably comprehend C better positive than you imagine you do. Windoze throws away such issues as that. it really isn't any longer C++'s fault any better than it really isn't any longer C++'s fault that its out of date and atypical style of OS protection has very nearly sponsored our multibillion dolllar malware market with botnets and extortions and thefts. In Unix and Linux, its offspring, go back 0 on the suitable of a software says you exited generally. go back a million, or go out(a million) says you've a situation. it truly is even as it makes a distinction.
2016-11-23 12:37:57
·
answer #3
·
answered by ? 4
·
0⤊
0⤋
return 0 signifies that the program has completed successfully and should end.
im not sure about the other two.
2006-08-05 22:55:55
·
answer #4
·
answered by Anonymous
·
0⤊
0⤋