title: C: 2d char array issue
body: <p>i've a problem with an exercise. The purpose is to print a specific picture after an int input (It is assumed that the input is > 3).</p>
  
  <p>Example: </p>
  
  <p><a href="https://i.stack.imgur.com/KRl0R.png" rel="nofollow noreferrer">https://i.stack.imgur.com/KRl0R.png</a></p>
  
  <p>This is my code: </p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  int main(void){
  
  int i, j, n, simbolo;   
  printf("Inserire un numero: ");
  scanf("%d", &amp;n);    
  
  char mat[n + 1][n + 2];
  simbolo = n+2;
  
  //initialization with blank space and setting 3 * diagonal
  for(i = 0; i &lt; n + 1; i ++){
      for(j = 0; j &lt; n + 2; j++){
          mat[i][j] = ' ';
          mat[n - 2][0] = '*';
          mat[n - 1][1] = '*';
          mat[n][2] = '*';
      }
  }
  
  //Add * diagonal of n length
  for(i = 0; i &lt; n + 1; i++){
      mat[i][simbolo] = '*';
      for(int x = i, y = 0; y &lt; n + 2; y++){ //Print current line
          printf("%c", mat[x][y]);
      }   
      printf("\n");
      simbolo--;
  }
  
  return 0;
  
  }
  </code></pre>
  
  <p>The output isn't correct, it's added an extra '*' in mat[1][0]:</p>
  
  <p><a href="https://i.stack.imgur.com/4Z5Fl.png" rel="nofollow noreferrer">https://i.stack.imgur.com/4Z5Fl.png</a></p>
  
  <p>Thanks in advance for you help</p>