title: C, How to use exit code properly?
body: <p>When I try to submit my work, the system told me to use the exit code. When I use return 0 and recheck, the system told me to use return 1...
  (<a href="https://i.stack.imgur.com/dnVLV.png" rel="nofollow noreferrer">https://i.stack.imgur.com/dnVLV.png</a>)</p>
  <pre><code>:) caesar.c exists.  
  :) caesar.c compiles.  
  :( encrypts &quot;a&quot; as &quot;b&quot; using 1 as key
      expected &quot;ciphertext: b\...&quot;, not &quot;ciphertext: b&quot;  
  :( encrypts &quot;barfoo&quot; as &quot;yxocll&quot; using 23 as key
      expected &quot;ciphertext: yx...&quot;, not &quot;ciphertext: yx...&quot;  
  :( encrypts &quot;BARFOO&quot; as &quot;EDUIRR&quot; using 3 as key
      expected &quot;ciphertext: ED...&quot;, not &quot;ciphertext: ED...&quot; 
  :( encrypts &quot;BaRFoo&quot; as &quot;FeVJss&quot; using 4 as key
      expected &quot;ciphertext: Fe...&quot;, not &quot;ciphertext: Fe...&quot;  
  :( encrypts &quot;barfoo&quot; as &quot;onesbb&quot; using 65 as key
      expected &quot;ciphertext: on...&quot;, not &quot;ciphertext: on...&quot;
  :( encrypts &quot;world, say hello!&quot; as &quot;iadxp, emk tqxxa!&quot; using 12 as key
      expected &quot;ciphertext: ia...&quot;, not &quot;ciphertext: is...&quot;  
  :( handle lack of argv[1]
      expected exit code 1, not 0  
  :( handles non-numeric key
      timed out while waiting for program to exit
  :( handles too many arguments
      expected exit code 1, not 0
  </code></pre>
  <p>How can I fix it and what's wrong with my code?</p>
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;cs50.h&gt;
  #include &lt;string.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;ctype.h&gt;
  
  int main(int argc, string argv[])
  {
      int ok;
      char r1;
      if (argc == 2)
      {
          for (int i = 0, s = strlen(argv[1]); i &lt; s; i++)
          {
              if (!isdigit(argv[1][i]))
              {
                  printf(&quot;Sorry\n&quot;);
                  return 0;
              }
              else
              {
                  ok = atoi(argv[1]);
                  string c = get_string(&quot;Enter:&quot;);
                  printf(&quot;ciphertext: &quot;);
                  for (int t = 0, a = strlen(c); t &lt; a; t++)
                  {
                      if (c[t] &lt; 91 &amp;&amp; c[t] &gt; 64)
                      {
                          r1 = (c[t] - 64 + ok) % 26 + 64;
                          printf(&quot;%c&quot;, r1);
                      }
                      else if (c[t] &lt; 123 &amp;&amp; c[t] &gt; 96)
                      {
                          r1 = (c[t] - 96 + ok) % 26 + 96;
                          printf(&quot;%c&quot;, r1);
                      }
                      else
                      {
                          printf(&quot;%c&quot;, c[t]);
                      }
                  }
                  return 0;
              }
          }
      }
      else
      {
          printf(&quot;Sorry\n&quot;);
      }
      printf(&quot;\n&quot;);
  
      return 0;
  }
  </code></pre>
  <p>I try to do well with my homework and all green...</p>