title: Context-free grammar in C
body: <p>I have an assignment to make a program in C that displays a number (n &lt; 50) of valid, context-free grammar strings using the following context-free grammar:</p>
  
  <pre><code>S -&gt; AA|0
  A -&gt; SS|1
  </code></pre>
  
  <p>I had few concepts of how to do it, but after analyzing them more and more, none of them were right.</p>
  
  <p>For now, I'm planning to make an array and randomly change <code>[..., A, ...]</code> for <code>[..., S, S, ...]</code> or <code>[..., 1, ...]</code> until there are only 0s and 1s and then check whether the same thing was already randomly generated.</p>
  
  <p>I'm still not convinced if that is the right approach, and I still don't know exactly how to do that or where to keep the final words because the basic form will be an array of chars of different length. Also, in C, is a two dimensional array of chars equal to an array of strings?</p>
  
  <p>Does this make any sense, and is it a proper way to do it? Or am I missing something?</p>