title: Why am I getting a “storage size isn't known” error in this C program?
body: <p>This is my code:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;unistd.h&gt;
  #include &lt;string.h&gt;
  
  #include &lt;curl/curl.h&gt;
  #include &lt;curl/types.h&gt;
  #include &lt;curl/easy.h&gt;
  char test[];
  size_t  write_data(char *ptr, size_t size, size_t nmemb, FILE *stream)
  {
    char buf[size*nmemb+1];
    char * pbuf = &amp;buf[0];
    memset(buf, '\0', size*nmemb+1);
    size_t i = 0;
    for(;  i &lt; nmemb ; i++){
      strncpy(pbuf,ptr,size);
      pbuf += size;
      ptr += size;
    }
  
    printf("%s",buf);
    test=new test[size*nmemb+1];
    return size * nmemb;
  }
  
  int main()
  {
      CURL *curl_handle;
      curl_handle = curl_easy_init();
  
      curl_easy_setopt(curl_handle,   CURLOPT_URL, "http://www.google.com");
      curl_easy_setopt(curl_handle,   CURLOPT_NOPROGRESS  ,1);
      curl_easy_setopt(curl_handle,   CURLOPT_WRITEFUNCTION,&amp;write_data);
      curl_easy_perform(curl_handle);
      curl_easy_cleanup(curl_handle);
      return 0;
  }
  </code></pre>
  
  <p>Why I am getting this error:</p>
  
  <pre><code>../src/get_webpage.cpp:9: error: storage size of ‘test’ isn't known
  ../src/get_webpage.cpp: In function ‘size_t write_data(char*, size_t, size_t, FILE*)’:
  ../src/get_webpage.cpp:23: error: expected type-specifier before ‘test’
  ../src/get_webpage.cpp:23: error: expected ‘;’ before ‘test’
  </code></pre>