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 want to get return value of main()
function then how can we get it?
In each main()
we write return 1
or return 0
; how can I know what my main()
has returned at terminal?
Edit:1
I get it that by echo $?
we can get the return value of main()
but it only allows me to return a value less then 125 (in Linux) successfully. A return value more than that cannot be be successfully received by the $ variable
so
why is int
the return type of main()
? Why not keep it short int
?
Edit2
From where can I find out the meaning of the error code if main()
returns a value greater than 125?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…