What will be the output of the following C# code?
static void Main(string[] args)
{
int a = 5;
int b = 0, c = 0;
method (a, ref b, ref c);
Console.WriteLine(b + " " + c);
Console.ReadLine();
}
static int method(int x, int p, ref int k)
{
p = x + x * x;
k = x * x + p;
return 0;
}
static void Main(string[] args)
{
int a = 5;
int b = 0, c = 0;
method (a, ref b, ref c);
Console.WriteLine(b + " " + c);
Console.ReadLine();
}
static int method(int x, int p, ref int k)
{
p = x + x * x;
k = x * x + p;
return 0;
}
A. 30, 55
B. 55, 30
C. Compile time error
D. 0, 0
Answer: Option C
Join The Discussion