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
Is c# an open source language?
What is difference between === and ==?
What is class method c#?
What are virtual classes in c#?
Explain About a class access specifiers and method access specifiers.
what is method overloading in c#?
What does int32 mean in c#?
What is the Signification of the "new " keyword in C#? example
What is a singleton unity?
Can namespace contain the private class?
Hello! How to do this: "Create manifest utility intended for creating update content files. Application should take a set of files as input parameter and generate XML based manifest file as output one." I use C# and vs.net 2003. It's urgent! Help please, thanks. Mayana
Explain anonymous type in c#?
Ho we can see assembly information?
How long does it take to learn c# for unity?
Which programming language is best for desktop applications?