int*
declares pointer to int
type. C# supports pointer in unsafe context. We can use the unsafe keyword in two different ways. It can be used as a modifier to a method, property, and constructor etc. For example:
using System;
class MyClass
{
public unsafe void Method()
{
int x = 10;
int y = 20;
int *ptr1 = &x;
int *ptr2 = &y;
Console.WriteLine((int)ptr1);
Console.WriteLine((int)ptr2);
Console.WriteLine(*ptr1);
Console.WriteLine(*ptr2);
}
}
class MyClient
{
public static void Main()
{
MyClass mc = new MyClass();
mc.Method();
}
}
The keyword unsafe can also be used to mark a group of statements as unsafe as shown below:
using System;
class MyClass
{
public void Method()
{
unsafe
{
int x = 10;
int y = 20;
int *ptr1 = &x;
int *ptr2 = &y;
Console.WriteLine((int)ptr1);
Console.WriteLine((int)ptr2);
Console.WriteLine(*ptr1);
Console.WriteLine(*ptr2);
}
}
}
class MyClient
{
public static void Main()
{
MyClass mc = new MyClass();
mc.Method();
}
}
Reference: Pointers in C#