I know that in C88 it always returns 0 integer value from main to a program, such as:
int main () {/ * here is some useful / return 0; }
This is to return the "successful" result to the operating system. I still consider myself a newbie (or best intermediate programmer) in C, but to date I have not fully understood why this is important.
My guess is, this is a useful return result if you are writing the output of this program in the form of another input, but I'm not sure. I have never found it useful, or maybe I did not understand what is the intention.
My question:
- C program always needs to return zero
- How to Return Value from
Main ()
Useful?
While typing a script (such as Bash, or CMD.exa on Windows) Command & amp; Amp; Amp; And || Operators
Canonically, A & amp; Amp; B will run
b
if the result of a
is zero, and a || B
will run b
if a
will return to the noose.
This is useful if you wish to command a command, if the last one is successful. For example, if you want to delete the file, if the word is foo then you will use it:
grep foo myfile & amp; Amp; RM myfile
grep
Returns 0 When a match occurs, and nozerz.
Comments
Post a Comment