ExamVeda
Login
Home
Classes and Objects in C Sharp
?

What will be the output of the following C# code?
{
    struct abc
    {
        public int i;
    }  
    class Program
    {
        static void Main(string[] args)
        {
            sample a = new sample();
            a.i = 10;
            fun(ref a);
            Console.WriteLine(a.i);
        }
        public static voidn fun(ref sample x)
        {
            x.i = 20; 
            Console.WriteLine(x.i);
        }
    }
}

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.