using System;
using System.Runtime.InteropServices;
class MainClass
{
static void Main(string[] args)
{
UsePointers();
}
static unsafe public void UsePointers()
{
char * pMyArray = (char*)Marshal.AllocCoTaskMem(6);
while (*pMyArray != '\0')
{
Console.WriteLine(*pMyArray);
pMyArray++;
}
Marshal.FreeCoTaskMem((IntPtr)pMyArray);
}
}
|