To use unsafe code blocks, open the properties for the project, go to the Build tab and check the Allow unsafe code checkbox, then compile and run.
class myclass
{
public static void Main(string[] args)
{
unsafe
{
int iData = 10;
int* pData = &iData;
Console.WriteLine("Data is " + iData);
Console.WriteLine("Address is " + (int)pData);
}
}
}
Output:
Data is 10
Address is 1831848