title: How to exit scanf loop when there is a space
body: <p>For example, the user shall put the input like that, "ABC123," but not "ABC 123" or "A BC123."</p>
  
  <p>Here is my code:</p>
  
  <pre><code>unsigned int convert_to_num(char * string) {
  unsigned result = 0;
  char ch;
  //printf("check this one %s\n", string);
  while(ch =*string++) result = result * 26 + ch - 'A' + 1;
  return result;
  }
  
  
  int main()
  {
  char input_string[100];
  char arr_col[100] = {'\0'};
  char arr_row[100] = {'\0'};
  int raiseflag;
  int started_w_alpha =0;
  int digitflag = 0;
  while(scanf("%s", &amp;input_string) != EOF) {
  
  int i = 0, j = 0, digarr = 0;
  
  while (i &lt;=5) {
  if (input_string[i] == '\0') {printf("space found!");}
  if ((input_string[i] &gt;= 'A' &amp;&amp; input_string[i] &lt;= 'Z') &amp;&amp; (digitflag == 0)) {
  started_w_alpha = 1;
  arr_col[j] = input_string[i]; j++;
  }
  //printf("something wrong here %s and %d and j %d\n", arr_holder, i, j);
  if (started_w_alpha == 1) {
  
      if (input_string[i] &gt;=48 &amp;&amp; input_string[i]&lt;=57){ digitflag = 1; arr_row[digarr] =input_string[i]; digarr++; }
  }
  
  i++; if (i == 5) { raiseflag =1; }
  
  }
  
  printf(" =&gt; [%d,%s]\n", convert_to_num(arr_col), arr_row);
  if (raiseflag == 1) { raiseflag = 0; memset(arr_col, 0, 5); memset(input_string, 0, 5); memset(arr_row, 0, 5); digitflag = 0; started_w_alpha = 0; }
  
   }
      return 0;
  
  }
  </code></pre>
  
  <p>Apparently, \0 doesn't work in my case because I have an array of 5 and user can put 2 chars. I want to exit the loop whenever a space is found in between the characters.</p>
  
  <p>This is the whole code. I added {'\0'} my array because of the extra characters I get when there is less than 5 characters.
  Thanks!</p>