title: Check if a string has only numbers in C?
body: <p>I'm trying to write a simple code to check if a string only has numbers in it. So far it's not working, any help would be appreciated.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;string.h&gt;
  #include &lt;ctype.h&gt;
  
  int main()
  {
      char numbers[10];
      int i, correctNum = 0;
  
      scanf("%s", numbers);
  
      for(i = 0 ; i &lt;= numbers ; ++i)
      {
          if(isalpha(numbers[i]))
          {
              correctNum = 1;
              break;
          }
      }
  
      if(correctNum == 1)
      {
          printf("That number has a char in it. FIX IT.\n");
      }
      else
      {
          printf("All numbers. Good.\n");
      }
      return 0;
  }
  </code></pre>