Exit () is a function that ends a process that deletes the memory space used by the process and returns the error message to the parent process, in which the wait system call will accept the return information.
Return returns the function value, which is the keyword.
We usually use return (0) in the main function, and return a value in such a way.
However, this is the form of void Main (), which is limited to non-void cases.
Exit () is usually used to terminate the program in a subroutine, and the program automatically ends the jumping operating system after use.
However, the value returned if main is defined as void is valid if the exit is used inside main, and exit does not need to consider the type, exit (1) is equivalent to return (1)
Exit (0); Normal exit
Non-0 is a non-normal exit
The number 0,1,-1 is written to the environment variable errorlevel, which can be used by other programs to determine the end state of the program.
General 0 for normal launch, the other number is abnormal, its corresponding error can be specified by itself.
What is the difference between return and exit?