如下byte [] s = new byte[size];byte *ps;怎么将 s赋給 ps 
或者如何给 byte * p 分配内存空间

解决方案 »

  1.   

    unsafe代码????还是你根本就不熟悉c#??
      

  2.   

    unsafe 的我是学生
    刚开始学现在边学边做课程设计  我看了看 是不是用fixed来做??
      

  3.   

    我看了看msdn 
    有这样一段代码You can initialize a pointer with the address of an array or a string:
      
    fixed (int* p = arr) ...  // equivalent to p = &arr[0]
    fixed (char* p = str) ... // equivalent to p = &str[0]
     
      

  4.   

    public unsafe void Test()
    {
    byte[] bufArray = new byte[10];
    fixed(byte* buf = bufArray)
    {
    //
    } }
      

  5.   

    System.Runtime.InteropServices.Marshal.Copy
      

  6.   

    用指针那你干吗要学C#?用C++,C 吧!C#里面很少用指针的。