What will be the output of the following C# code snippet?
class UnsafeCode
{
unsafe static void Main()
{
int* a;
int a1 = 10;
int b1;
b1 = *&a1;
a = &b1;
{
Console.WriteLine(*a);
Console.ReadLine();
}
}
}
class UnsafeCode
{
unsafe static void Main()
{
int* a;
int a1 = 10;
int b1;
b1 = *&a1;
a = &b1;
{
Console.WriteLine(*a);
Console.ReadLine();
}
}
}A. program will print garbage value
B. program will print address of a
C. program will print value of a1
D. program will print address of a1
Answer: Option C

Join The Discussion