ExamVeda
Login
Home
Miscellaneous in C Sharp
?

What will be the output of the following C# code snippet?
unsafe static void Main()
{
    int a = 5;
    int b = 5;
    int c = 5;
    int*[] ptr = new int* [3];
    ptr[0] = &a;
    ptr[1] = &b;
    ptr[2] = &c;
    for (a = 0; a < 3; a++)
    {
        c += *ptr[a];
        Console.WriteLine(c);
    }
    Console.ReadLine();
}

Answer & Solution
Correct Answer: Option D
Let's discuss the solution. Join the discussion
Examveda
Question posted by Examveda
Community

Join the Discussion

No comments yet Be the first to discuss this question.