110,533
社区成员
发帖
与我相关
我的任务
分享
void f2(int a[])
{
}
void f1()
{
int a[10];
f2(a + 5); //C++中可直接传a[5]的地址给f2函数
}
static void f2(int a[])
{
}
static void f1()
{
int a[10];
f2(a + 5); //C#中不可直接传a[5]的地址给f2函数
}
void f2(UINT32 *a)
{
}
void f1()
{
UINT8 a[10];
f2((UINT32 *)a); //C++中可直接强制把UINT8*转换为UINT32*并传给f2函数
}
static void f2(uint a[])
{
}
static void f1()
{
byte a[10];
f2(???); //C#中试过,但都不成功,怎么传呢?
}
static void f2(ref int a)
{
}
static void f1()
{
int a[10];
f2(ref a[5]);
}
unsafe class Program
{
static void f2(int* a)
{
}
static void f3(UInt32* a)
{
}
static void f1()
{
fixed (int* a = new int[10])
{
f2(a + 5);
f3((UInt32*)a);
}
}
}