title: isdigit and arrays in C
body: <p>I am trying to create a function that takes the users input as a string then I use the <code>atoi()</code> function. I have it working hard coded but it will not work when I put it into a for loop in my <code>void getUserInput()</code> function:</p>
  
  <pre><code>    for(i = 0; i &lt; 3; i++)
          {
              switch(num)
              {
                 case 1: 
                      printf("Enter number one: ");
                      break;
                 case 2: 
                      printf("Enter number one: ");
                      break;
                 case 3: 
                      printf("Enter number one: ");
                      break;
              }
  
              fgets(input, 50, stdin);
  
              if(isdigit(input[i]))
              {
                if(isdigit(input[i + 1]))
                {
                  if(isdigit(input[i + 2]))
                  {
                    printf("Error\n");
                  }
                  else
                  {
                    ...
  </code></pre>
  
  <p>I know that the way I incremented the <code>isdigit()</code> is the problem but I do not know another way how to check the first char, then second then third from the users input. Any suggestions on how to increment it? </p>
  
  <p>by the way if this helps:
  <code>char input[50];</code></p>