Where does C language return return to?

angryTom
Release: 2020-02-15 17:26:46
Original
10701 people have browsed it

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;
}
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!