What will be the output of the following C# code segment?
class UnsafeCode
{
unsafe static void Main()
{
int n = 10;
void* p = &n;
Console.WriteLine(*p);
Console.ReadLine();
}
}
class UnsafeCode
{
unsafe static void Main()
{
int n = 10;
void* p = &n;
Console.WriteLine(*p);
Console.ReadLine();
}
}
A. The program will print 10
B. Run time error
C. Compile time error
D. Output is the address contained in p
Answer: Option C
Join The Discussion