What will be out put of following code:
static void doIncrement(ref int param)

static void Main()
int arg; // not initialized
doIncrement(ref arg);

 Posted by Kundan64 on 1/23/2013 | Category: C# Interview questions | Views: 1995 | Points: 40

It will give Compile time error:Use of unassigned local variable 'arg'
as C# enforces the rule that we must assign a value to a variable before we can read it. This rule also applies to method arguments, we cannot pass an uninitialized value as an argument to a method even if an argument is defined as a ref argument.

Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response