title: While loop not seeing or finding terminating null character
body: <p>I am trying to iterate through a char array using a while loop using '\0' as the terminating condition, but my problem is that its not finding the '\0' until index position 481, the array is declared as 200 long and I cant see what I am doing wrong!! I cannot use strings or any form of string functions for this before anyone asks. Can anyone help??</p>
  
  <pre><code>#include &lt;iostream&gt;
  
  using namespace std;
  
  int main()
  {
  
  
  char fullString[200]={'\0'}; // Declare char string of 200, containing null characters
  int alphaCount = 0;
  int charCount = 0;
  int wordCount = 0;
  
  cin.getline(fullString,200); //
  cout &lt;&lt; "\n\n" &lt;&lt; fullString;
  cout &lt;&lt; "\n\n\n";
  
  int i=0;
  int i2 = 0;
  while(fullString[i]!='\0'){ //iterate through array until NULL character is found
  
      cout &lt;&lt; "\n\nIndex pos : " &lt;&lt; fullString[i]; //Output char at 'i' position
  
  
     while(fullString[i2]!= ' '){ //while 'i' is not equal to SPACE, iterate4 through array
  
          if(isalpha(fullString[i2])){
  
              alphaCount++; // count if alpha character at 'i'
          }
          charCount++; // count all chars at 'i'
          i2++;
      }
  
      if(charCount == alphaCount){ // if charCount and alphaCount are equal, word is valid
  
          wordCount++;
      }
     charCount = 0; // zero charCount and alphaCount
     alphaCount = 0;
  
     i=i2;// Assign the position of 'i2' to 'i'
     while(fullString[i] == 32){ //if spaces are present, iterate past them
  
          i++;
          cout &lt;&lt; "\n\ntest1";
  
     }
      i2 = i; // assign value of 'i' to 'i2' which is the next position of a character in the array
  
      if(fullString[i] == '\0')
      {
          cout &lt;&lt; "\n\nNull Character " &lt;&lt; endl;
          cout &lt;&lt; "found at pos: " &lt;&lt; i &lt;&lt; endl;
      }
  
  }
  
  cout &lt;&lt; "\n\ni" &lt;&lt; i;
  cout &lt;&lt; "\n\nWord" &lt;&lt; wordCount;
  
  return 0;
  </code></pre>
  
  <p>}</p>