title: How to de-allocate an array of characters in c?
body: <p>I'm writing a program that asks the number of strings which i'll then count how many spaces it has.
  My problem is when I start a new cycle I can't allocate the array of characters I use to count the spaces.
  Thanks in advance.</p>
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;string.h&gt;
  int main(){
      char a[20];
      int x, z, esp=0, num;
      scanf(&quot;%d\n&quot;, &amp;num);
      
      int array[num];
      
      for (int i=0;i&lt;num;i++){
         
          scanf(&quot;%[^\n]&quot;, &amp;a);
      
          z =strlen(a);
      
          for (x=0; x&lt;=z; x++){
              if (a[x] == ' '){
              
                  esp++;
              } 
          }
          array[i] = esp;
          esp =0;
          
      }
      
      for (int i=0;i&lt;num;i++){
          printf (&quot;%d\n&quot;, array[i]);
      }
  return 0;
  }
  </code></pre>