Home >Backend Development >C#.Net Tutorial >Where does C language return return to?
c language return returns to where
c language return returns to the upper level, such as a recursive program, from the third level Return to the second level; for example, if it is an ordinary subroutine, then return to the main program.
The return in the main program is returned to the operating system.
For example, the following C program
int sum(int a, int b) { return a + b; } int main(int argc, char const *argv[]) { int c = sum(1000, 24); return 0; }
The main function calls the sum function, the return of sum is returned to main, and the return in main is returned to the operating system. You can use echo $ under Linux system ?Query this value.
$? represents the exit status of the last command. The success value is 0, and the unsuccessful value is non-0! , using return 0 in a C program means that the program is running normally and there are no errors.
Recommended learning: c language video tutorial
The above is the detailed content of Where does C language return return to?. For more information, please follow other related articles on the PHP Chinese website!