Set a for loop to loop through untill null byte is detected
<p>I have a question about a string in C++. As per below code, I would like to know where will the loops stop at. Will it take the null in index 3 or index 4?</p>

<pre><code>#include &lt;cstdio&gt;

int main ( ) {

  char name [20] = "Foo";

  name [4] = '\0';

  for (int i = 0; name[i] != '\0'; i++) {

       printf("This is the value of i so far in the loop : %d \n",i);
  }

  printf("This is the value of i : %d \n",i);

 return 0;

}
</code></pre>

<p>the reason I am asking this is,I don't understand why in my homework they gave us something like this. Is there any reason to make '\0' in index 4?</p>
