How can I get what my main function has returned?

前端 未结 5 1847
隐瞒了意图╮
隐瞒了意图╮ 2020-12-04 15:28

In a C program if we want to give some input from terminal then we can give it by:

int main(int argc, char *argv[])

In the same way, if we

5条回答
  •  抹茶落季
    2020-12-04 15:44

    Your shell probably has a special variable $?, which holds the last program returned value. So, soon after your program finishes, you can run:

    echo $?
    

    to see the returned value.

提交回复
热议问题