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
Define a manifest in .net?
Why we use oops in c#?
What is reference types in c#?
What is ispostback c#?
When was .net linq added?
What is datetime parse in c#?
How does it work?
How can I get the ascii code for a character in c#?
Define Virtual folder?
Explain async and await?
Explain deadlock?
Is equal in c#?
What is difference between web and window application?
Where is the keyword void used?
Explain About Global.asax