mark method as unsafe
class FixedArrayApp
{
unsafe public static void Foo(int* pa)
{
for (int* ip = pa; ip < (pa+5); ip++)
{
Console.Write("{0,-3}", *ip);
}
}
static void Main(string[] args)
{
int[] ia = new int[5]{12,34,56,78,90};
unsafe
{
fixed (int* pa = ia)
{
Foo(pa);
}
}
}
}
Related examples in the same category