What will be the output of the following C# code?
static void Main(string[] args)
{
int a = -1;
int b = -1;
if (Convert.ToBoolean (++a = ++b))
Console.WriteLine("a");
else
Console.WriteLine("b");
Console.ReadLine();
}
static void Main(string[] args)
{
int a = -1;
int b = -1;
if (Convert.ToBoolean (++a = ++b))
Console.WriteLine("a");
else
Console.WriteLine("b");
Console.ReadLine();
}A. a
B. b
C. Compile time error
D. Code execute successfully with no output
Answer: Option C

Join The Discussion