title: Initialize a minesweeper in c
body: <p>I'm currently rewriting a minesweeper program in C using the CSFML library.</p>
  
  <p>I'm having some issues at managing the initialization only after the first click, more precisely in the part where I'm supposed to set the tiles around the click empty.</p>
  
  <p>I can't find a way to make these tiles empty without having a risk of removing some bombs. 
  Here's my init code block for now : </p>
  
  <pre><code>int current = 0;
  
      temp.bombs = BOMB_EASY;
      temp.difficulty = EASY;
      temp.mapEasy = malloc(sizeof(sTILE *) * (Y_EASY + 1));
  
      for (int i = 0; i &lt; Y_EASY + 1 ; i++)
      {
          temp.mapEasy[i] = malloc(sizeof(sTILE) * (X_EASY + 1));
      }
  
      for (int i = 0; i &lt; X_EASY + 1; i++)
      {
          temp.mapEasy[Y_EASY][i].type = 0;
      }
  
      while (current &lt; BOMB_EASY)
      {
          for (int i = 0; i &lt; Y_EASY; i++)
          {
              for (int j = 0; j &lt; X_EASY; j++)
              {
                  int isBomb = rand() % 10;
                  if (isBomb == 0 &amp;&amp; current &lt; BOMB_EASY &amp;&amp; temp.mapEasy[i][j].type != 9)
                  {
                      temp.mapEasy[i][j].type = 9;
                      current++;
                  }
                  else if (temp.mapEasy[i][j].type != 9)
                  {
                      temp.mapEasy[i][j].type = 0;
                  }
              }
          }
      }
  
      for (int i = 0; i &lt; Y_EASY; i++)
      {
          for (int j = 0; j &lt; X_EASY; j++)
          {
              if (temp.mapEasy[i][j].type == 0)
              {
                  temp.mapEasy[i][j].type = HowManyBombs(temp.mapEasy, i, j, Y_EASY, X_EASY);
              }
              temp.mapEasy[i][j].isRevealed = sfFalse;
              temp.mapEasy[i][j].isFlagged = sfFalse;
          }
      }
  }
  </code></pre>
  
  <p>I know my question might seem stupid and someone probably already answered it but I couldn't find the answer so thanks at the ones who will answer me.</p>