Archives by Tag 'unsafe'

C# Pointer in unsafe context

By admin - Last updated: Saturday, September 20, 2008

Pointer usage in C# in unsafe context

static unsafe void Main()
{
    int i;
    int[] array = { 11, 22, 33 };

    // pointer pi has the address of variable i
    int* pi = &i;

    i = 0;
    // dereference the pi, i.e. *pi is i
    Console.WriteLine(”i = {0}”, [...]