class Program
{




void add()
{
int x=10, y=20;
fun();
Console.WriteLine("{0}", sum);

}

void fun()
{
int sum;
sum = x + y;

}
static void Main(string[] args)
{
Program f =new Program();
f.add();

}
}

Debug above program.....

Answer Posted / simhachalam

Actually you defined x,y variable in add() function so that
variables you can't access outside of method .finally u got
error is undefined variables x,y.

Is This Answer Correct ?    2 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Define a manifest in .net?

744


Why we use oops in c#?

743


What is reference types in c#?

672


What is ispostback c#?

650


When was .net linq added?

712


What is datetime parse in c#?

685


How does it work?

663


How can I get the ascii code for a character in c#?

736


Define Virtual folder?

798


Explain async and await?

889


Explain deadlock?

671


Is equal in c#?

667


What is difference between web and window application?

578


Where is the keyword void used?

713


Explain About Global.asax

721