-1
Without changing the actual function, call it in such a way that it prints "True"
void Puzzle(out int x, out int y)
{
x = 0;
y = 1;
Console.WriteLine(x == y);
}
-1
Without changing the actual function, call it in such a way that it prints "True"
void Puzzle(out int x, out int y)
{
x = 0;
y = 1;
Console.WriteLine(x == y);
}
5
Reusing reference:
//C# Puzzle: Call the Puzzle() function in Main such that it prints True.
//You have to do this without changing the Puzzle method.
public void Main()
{
int x,y;
Puzzle(out x, out x);
}
void Puzzle(out int x, out int y)
{
x = 0;
y = 1;
Console.WriteLine (x == y);
}
4
2Programming puzzle challenges should usually include some indication how the "best" answer is chosen is several valid solutions are posted. – Martin Ender – 2015-03-17T09:08:41.307