title: "Parse error before "]" token" when assigning to variable[]
body: <p>My C program is as follows. It seeks to read a set of values from a file and create a table that produces the average of some floating point numbers.</p>
  <pre><code>int main(void)
  {
  
      int lake, beach, samples, count, sum;
      float e_coli, ave;
      char recc[20], lakename[20], beachname[20];
      FILE *in;
      sum = 0;
      count = 0;
      in = fopen(&quot;july15.data&quot;, &quot;r&quot;);
      printf(&quot;Lake   |   Beach   | Avg E Coli Level |  Reccomendation |\n&quot;);
      while (1)
      {
          fscanf(in, &quot;%d, %d, %d&quot;, &amp;lake, &amp;beach, &amp;samples);
          count = samples;
          while (count &lt; samples)
          {
              fscanf(in, &quot;%f&quot;, e_coli);
              sum = sum + samples;
          }
          ave = sum / samples;
          if (lake == 1)
              lakename[] = &quot;Ontario&quot;;
          else if (lake == 2)
              lakename[] = &quot;Erie&quot;;
          else if (lake == 3)
              lakename[] = &quot;Huron&quot;;
          else if (lake == 4)
              lakename[] = &quot;Muskoka&quot;;
          else if (lake == 5)
              lakename[] = &quot;Simcoe&quot;;
          if (beach == 100)
              beachname[] = &quot;Kew Beach&quot;;
          else if (beach == 101)
              beachname[] = &quot;Sunnyside Beach&quot;;
          else if (beach == 102)
              beachname[] = &quot;Sandbanks&quot;;
          else if (beach == 201)
              beachname[] = &quot;Port Dover&quot;;
          else if (beach == 202)
              beachname[] = &quot;Port Burwell&quot;;
          else if (beach == 203)
              beachname[] = &quot;Crystal Beach&quot;;
          else if (beach == 301)
              beachname[] = &quot;Goderich&quot;;
          else if (beach == 302)
              beachname[] = &quot;Sauble Beach&quot;;
          else if (beach == 303)
              beachname[] = &quot;Kincardine&quot;;
          else if (beach == 401)
              beachname[] = &quot;Muskoka Beach&quot;;
          else if (beach == 501)
              beachname[] = &quot;Sibbald Point&quot;;
          if (samples &lt; 3)
              recc[] = &quot;INSUFFICENT DATA&quot;;
          else if (samples &gt; 3 &amp;&amp; ave &lt; 50)
              recc[] = &quot;OPEN&quot;;
          else if (samples &gt; 3 &amp;&amp; ave &gt; 50)
              recc[] = &quot;CLOSED&quot;;
          printf(&quot;%s,      %s,      %f,      %s\n&quot;, lakename, beachname, ave, recc);
      }
      return(0);
  }
  </code></pre>
  <p>Unfortunately it produces the error <code>parse error before &quot;]&quot; token</code> on lines 22, 32, and 54. Effectively these are the first areas where the string is defined. So line 22 is <code>lakename[] = &quot;Ontario&quot;</code> line 32 is <code>beachname[] = &quot;Kew Beach&quot;</code> and line 54 is <code>recc[] = &quot;INSUFFICIENT DATA&quot;</code>.</p>
  <p>I've tried inserting the number of spaces into the <code>[]</code> (i.e. <code>lakename[9] = &quot;Ontario&quot;</code>) but then I get a subsequent error <code>&quot;assignment makes integer from pointer without cast&quot;</code>.</p>