Simple C program crashes : <p>what's wrong with my code? It crash after displaying the board.Is there anything wrong on the character function? I've mulled over this for at least an hour and I still can't find out what the problem is.</p>

<p>Here's my code:</p>

<pre><code>#include &lt;stdio.h&gt;

void gameboard(char board[8][8])
{

 int x, y;

  for(x=0; x&lt;16; x++)
  {
   for(y=0; y&lt;8; y++)
    {
    if(x % 2 == 0)
    {
    printf(" %c ", board[x][y]);
    }else{
    printf("| %c |",board[x][y]);
    }

  }printf("\n");

  }




}
void character(char board[8][8])
{
 int x,y;

 for(x=0;x&lt;16;x++){
   for(y=0;y&lt;8;y++){

    if(x&lt;6){

       if(x%2 == 0){
              if(x%2 == 0){
              board[x][y] = ' ';

              }
             }



       if(x%2 == 1){
              if(y%2 == 0){
              board[x][y] = 'O';
               }
              if(y%2 ==1){
             board[x][y]= ' ';

              }
       }

      if(x==3){
         if(y%2 == 1){
         board[x][y] = 'O';
         }
         if(y%2 == 0){
         board[x][y] = ' ';
         }
        } 
    }

    if((x==6)||(x==7)||(x==8)||(x==9)){
    board[x][y] = ' ';
    } 


    if(x&gt;9)
    {  

       if(x%2 == 0){
              if(x%2 == 0){
              board[x][y] = 'X';

              }
              if(y%2 == 0){
              board[x][y] = ' ';
             }

       }  

      if(x%2 == 1){
              if(y%2 == 1){
              board[x][y] = ' ';
               }

       }
        if(x==12){
         if(y%2 == 0){
         board[x][y] = 'X';
         }
         if(y%2 == 1){
         board[x][y] = ' ';
         }

       }  

    }               

  }
 }
}



int main()
{

  char bx[8][8];




  character(bx); 

  gameboard(bx);




 return 0;

}
</code></pre>
