What is scope of a variable? (LOLZ)

Answers were Sorted based on User's Feedback



What is scope of a variable? (LOLZ)..

Answer / aboelella

Variable scope is the places in code where this variable can
be accessed

Varaible can be defined to be global (visible in the program
include scope)

Variable can be local if defined in the scope of parantesis
(inside function or in compound statement)

In classes variables scope depends on the way it is defined
(privat, public or protected)

Is This Answer Correct ?    21 Yes 0 No

What is scope of a variable? (LOLZ)..

Answer / lovly

One of the really big pluses with GOSUB/RETURN is that you
can share variables that are neither global nor restricted
to one piece of code.

With or without that functionality, how about a way to
share variables (with memory of course) between only
certain subs/functions? Something like:
(per function/sub)

"STATIC SHARED as integer namespace_name.variable_name =
0" -OR-
"STATIC SHARED namespace_name.variable_name as integer"

Usage would just be: "variable_name" -- no "." or namespace
prefix.

I think that would be a great addition to FB. Thoughts

Is This Answer Correct ?    2 Yes 5 No

Post New Answer

More C++ General Interview Questions

Is structure can be inherited?

5 Answers   HP, ST Micro,


Write a program to show polymorphism in C++?

0 Answers   Impetus, Verifone,


what are function pointers?

0 Answers  


Write my own zero-argument manipulator that should work same as hex?

0 Answers  


How long will it take to learn programming?

0 Answers  






What is design pattern?

2 Answers   Samsung,


What is vector pair in c++?

0 Answers  


What is c++ and its features?

0 Answers  


Explain the concept of inheritance in C++.

1 Answers  


Explain operator overloading.

0 Answers  


Write a c++ code that will calculate the roots of a quadratic equation a2+ bx+c=0 Hint: d = sqrt (b2-4ac), and the roots are: x1 = (€“b + d)/2a and x2 = (€“b €“ d)/2a (use sqrt function from cmath.h )?

0 Answers   Maxobiz,


class basex { int x; public: void setx(int y) {x=y;} }; class derived : basex {}; What is the access level for the member function "setx" in the class "derived" above? a) private b) local c) global d) public e) protected

3 Answers   Quark,


Categories