title: Optimized method to check if an integer lies in the given range/bounds check
body: <p>In c programming to find if any given value lies between the range, <code>if</code> condition is used as below.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;string.h&gt;
  #include &lt;ctype.h&gt;
  
  #define U_LIMIT     100
  #define L_LIMIT    -100
  
  int check_num(char *in)
  {
      int i = 0;
  
      if (in[i] == '-' || in[i] == '+') {
          i++;
          if (in[i] == '\0')
              return 0;
      }
  
      while (i &lt; strlen(in)) {
          if(!isdigit(in[i]))
              return 0;
          i++;
      }
      return 1;
  }
  
  int main(int argc, char *argv[])
  {
      int i;
      if (argc != 2)
         return 1;
  
      if (!check_num(argv[1])) {
         printf("Not a digit\n");
         return 1;
      }
  
      i = atoi(argv[1]);
      if (i &lt; U_LIMIT &amp;&amp; i &gt; L_LIMIT)
         printf("Within Range\n");
      else
         printf("Outside Range\n");
  
      return 0;
  }
  </code></pre>
  
  <p>Sample Output:</p>
  
  <pre><code>./a.out 1    -&gt; Within Range
  ./a.out 100  -&gt; Outside Range
  ./a.out -100 -&gt; Outside Range
  ./a.out -    -&gt; Not a digit
  ./a.out e    -&gt; Not a digit
  </code></pre>
  
  <p>My question is that </p>
  
  <blockquote>
    <ol>
    <li>Can the above program be optimized(for speed) further without loosing out any of the error check conditions?</li>
    <li>Is there any other best optimized(for speed) method to solve for the same issue?</li>
    </ol>
  </blockquote>