title: Writing values in a 2 dimensional array in c
body: <p>Being new to C, and this website, I'm unfamiliar with this problem I'm having. I have a 2 dimensional array with [8][8] elements. I'm trying to get the user to enter numbers into the array until finished. The program is far from finished, but I'm stuck on this problem before I can move on. Basically I use a for loop to let the user enter into each element. However, when the first row is complete, it overwrites it's last value onto the first column second row element spot. How can I prevent this from happening: Here's my code:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;string.h&gt;
  
  int Check_rules();
  
  void Print_Array(int array[][8], int size)
  {
    int i, j;
    for (i = 0; i &lt;= size; i++)
    {
      printf("\n");
      for (j = 0; j &lt;= size; j++)
      {
        printf("%d ",array[i][j]);
      }
    } 
    printf("\n\n");
  }
  
  int main()
  {
    int size = 8;
    int i, j;
  
  
    int fullArray[size][size];
    int grid1[3][3];
    int grid2[3][3];
    int grid3[3][3];
    int grid4[3][3];
    int grid5[3][3];
    int grid6[3][3];
    int grid7[3][3];
    int grid8[3][3];
    int grid9[3][3]; 
  
    for (i = 0; i &lt;= size; i++)
    {
      for (j = 0; j &lt;= size; j++)
        fullArray[i][j] = 0;
  
    } 
  
    printf("Want to play a game? Enter values 1-9 starting in row 1 column 1, \nand we will work our way from there. Here's the playing board.\nIt's Sudoku, so follow the rules of the game.\n\n");
  
    for (i = 0; i &lt;= size; i++)
    {
      printf("\n");
      for (j = 0; j &lt;= size; j++)
        printf("%d ",fullArray[i][j]);
  
    } 
    printf("\n\n");
  
    int tmp;
    char *keeper = (" ");//space for marker
  
    for (i = 0; i &lt;= size; i++)
    {
  
      for (j = 0; j &lt;= size; j++)
      {
        printf("Enter first value(press 0 and ENTER to skip a box, \nand -1 to cancel    game): ");
  
        scanf("%d", &amp;tmp);
        if(tmp == -1)
          return 0;
  
        fullArray[i][j] = tmp;
        Print_Array(fullArray,size);
      }
  
    }
  
    return 0;
  }
  </code></pre>
  
  <p>If you run this you'll see my problem when you enter the last value in row 1. It overwrites the second row first column element spot? </p>