Unsafe code in C#
Unsafe : This means pointers are allowed in C# code. If you wish to compile unsafe code then should specify the /unsafe compiler option in the command line(This is not required if you are using Visual Studio.NET).
Related postsusing System;
class zzz {
public static void Main() {
yyy a = new yyy();
a.abc();
}
}
unsafe class yyy {
unsafe public void abc() {
int *i; //declaring pointer
int j=1;
i = &j; //pointing
Console.WriteLine((int)i);
*i = 10;
Console.WriteLine(j);
}
}