C# Programming - Structures - Discussion
Discussion Forum : Structures - General Questions (Q.No. 13)
13.
Which of the following will be the correct output for the C#.NET program given below?
namespace IndiabixConsoleApplication
{
struct Sample
{
public int i;
}
class MyProgram
{
static void Main(string[] args)
{
Sample x = new Sample();
x.i = 10;
fun(ref x);
Console.Write(x.i + " ");
}
public static void fun(ref Sample y)
{
y.i = 20;
Console.Write(y.i + " ");
}
}
}
Discussion:
1 comments Page 1 of 1.
Abhishek Jha said:
1 decade ago
Ref Keyword used as function parameter when we have to modify the value in calling function.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers