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
What do you mean by sealed classes and static classes?
What does console writeline do?
What are the properties in c#?
What is polymorphism in c sharp?
How do you declare a method in c#?
What is difference between constants and read-only?
Between windows authentication and sql server authentication, which one is trusted and which one is untrusted?
What do multicast delegates mean?
What are static and dynamic variables?
Can you use foreach iteration on arrays in c#?
What is use of FormBoarderStyle Propertie
How can I check the type of an object at runtime?
Explain the use of virtual, sealed, override, and abstract method?
What is form feed and carriage return?
Explain the difference between the system.array.copyto() and system.array.clone()?