Register Now

Login

Lost Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

What will be the output of the following C# code?
public static void Main(string[] args)
{
p();
void p()
{
Console.WriteLine(“hi”);
}
}

What will be the output of the following C# code?
public static void Main(string[] args)
{
p();
void p()
{
Console.WriteLine(“hi”);
}
}
a)Compile time error
b) hi
c) hi infinite times
d) None of the mentioned

Answer: a
Explanation: Invalid definition of function p() inside main().

Join The Discussion