title: Problems with '\0' in 2d array
body: <p>For some reason, when I execute case 1, I am assigned the time 4pm, so it doesn't find the \0 in the first 3 instances of i, but finds it on the fourth.  I am just a little confused on how the null character works with a 2d array, is it stored by default in every row, does it need to be added?  I am trying to have a 5x20 array with 5 different slots for names.  Thanks in advance</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;string.h&gt;
  int main()
  {
      int i;
      int j;
      int total=0;
      int opt;
      int time;
      char x[5][20];
      char name[20];
  
      printf("----MAIN MENU----\n");
      printf("1: Request a lesson\n");
      printf("2: Cancel a lesson\n");
      printf("3: See available lessons\n");
      printf("4: List all names starting with a letter\n"); 
      printf("9: Quit\n");
  
  
      for(;;)
      {
          scanf("%d",&amp;opt);
          switch(opt)
          {
              case 1:
                  printf("please enter your name\n");
                  scanf("%s",name);
  
                  //if schedule is full
                  if(total==5)
                  {   
                      printf("Sorry, the teacher is too busy, try again tomorrow.\n");
                  }
  
  
                  //opening in schedule
                  else
                      for(i=0;i&lt;5;i++)
                          if (x[i][0]=='\0')
                          {
                              strcpy(x[i], name);
                              total++;
                              printf("You have been assigned the time %dpm\n",i+1);
                              break;
                          }
  
                  break;
  </code></pre>