title: C Language - How to make rand value a constant for masking and unmasking in a hangman game
body: <p>I am doing a project for a small hangman game that picks from a random selection of words and the user has to guess what the word is with a scanf inputting letters with a counter that builds a hangman, resulting either in a game over or win.</p>
  <p>The issue lies in that when using the word[x] it isn't accepting it as &quot;Expression must have a constant value&quot;, this error comes up in;</p>
  <pre><code>int mask[m];
  </code></pre>
  <p>and</p>
  <pre><code>mask[i] = 0;
  </code></pre>
  <p>All I can guess is that the rand function is the issue, but I have no idea how to fix it, anyone has a clue?</p>
  <pre><code>#include&lt;stdio.h&gt;
  #include&lt;string.h&gt;
  #include&lt;stdlib.h&gt;
  #include &lt;time.h&gt;
  #include &lt;string&gt;
  #define ARRAY_SIZE 10
  
  int main()
  {
      //randomwordgenerator
      char word[ARRAY_SIZE][200] = { &quot;tiger&quot;, &quot;lion&quot;, &quot;elephant&quot;, &quot;zebra&quot;, &quot;horse&quot;, &quot;camel&quot;, &quot;deer&quot;, &quot;crocodile&quot;, &quot;rabbit&quot;, &quot;cat&quot; };
  
  
      int x = 0;
      srand(time(0));
  
      x = rand() % ARRAY_SIZE;
  
      system(&quot;pause&quot;);
  
      //masking and unmasking word
      char m = strlen(word[x]);//will count the number of letters of the random word
      int mask[m];
      for (int i = 0; i &lt; m; ++i) {
          mask[i] = 0;
      }
  
      return 0;
  }
  //Still have to do the loop and counter that prints out hangman
  </code></pre>