title: Passing char * parameter to C# function
body: <p>C++ win32dll1.dll:</p>
  
  <pre><code>extern "C" __declspec(dllexport) int getSerialNumber(char* outs)
  {
      char s[2];
      s[0]='0';
      s[1]='1';
  
      for(int i=0; i &lt; 2; ++i){
          outs[i] = s[i];
      }
      return 1;
  }
  </code></pre>
  
  <p>C#:</p>
  
  <pre><code>[DllImport("win32dll1.dll")]
  public unsafe static extern int getSerialNumber(char* ss);
  </code></pre>
  
  <p>Not able to pass <code>s</code> in the function</p>
  
  <pre><code>char[] s = new char[2];
  getSerialNumber(s);
  </code></pre>
  
  <p>Shouldn't this work? Why or why not?</p>