title: How to pass a pointer as an array argument?
body: <p>I have a third-party library, which has a function delared as follows:</p>
  
  <pre><code>void foo(const void* input, char output[1024]);
  </code></pre>
  
  <p>If I write something like this:</p>
  
  <pre><code>char* input = "Hello";
  char  output[1024];
  foo(input, output); // OK
  </code></pre>
  
  <p>But I don't want to declare such a big array on stack (that would be very dangerous in OS kernel environment). So I have to do something like this:</p>
  
  <pre><code>char* input      = "Hello";
  char* output_buf = new char[1024];
  foo(input, output_buf); // Compiler Error C2664
  </code></pre>
  
  <p>I cannot change the implementation of foo. How should I do?</p>
  
  <p>=================</p>
  
  <p>The problem has been resolved. My real code is like this:</p>
  
  <pre><code>char* input      = "Hello";
  void* output_buf = new char[1024];
  foo(input, output_buf); // Compiler Error C2664
  </code></pre>
  
  <p>conversion from void* to char* is not implicitly accepted by the standard. So the following code works:</p>
  
  <pre><code>char* input      = "Hello";
  void* output_buf = new char[1024];
  foo(input, (char*)output_buf); // OK
  </code></pre>