title: How can I get what my main function has returned?
body: <p>In a C program if we want to give some input from terminal then we can give it by:</p>
  
  <pre><code>int main(int argc, char *argv[])
  </code></pre>
  
  <p>In the same way, if we want to get return value of <code>main()</code> function then how can we get it?</p>
  
  <p>In each <code>main()</code> we write <code>return 1</code> or <code>return 0</code>; how can I know what my <code>main()</code> has returned at terminal?</p>
  
  <p><strong>Edit:1</strong></p>
  
  <p>I get it that by <code>echo $?</code> we can get the return value of <code>main()</code> 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 <code>$ variable</code> so </p>
  
  <p><strong>why is <code>int</code> the return type of <code>main()</code>? Why not keep it <code>short int</code>?</strong></p>
  
  <p><strong>Edit2</strong></p>
  
  <p>From where can I find out the meaning of the error code if <code>main()</code> returns a value greater than 125?</p>