What is scope of a variable? (LOLZ)
Answers were Sorted based on User's Feedback
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 |
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 |
How can we access protected and private members of a class?
What is algorithm in c++ programming?
Why cstdlib is used in c++?
What is the full name of logo?
What is the use of endl in c++ give an example?
The "virtual" specifier in a member function enables which one of the following? a) Monmorphism b) Late binding c) Metamorphism d) Solomorphism e) Inheritance
What is a dangling pointer in c++?
Explain all the C++ concepts using examples.
What is class and structure in c++?
How does a C++ structure differ from a C++ class?
What is the best free c++ compiler for windows?
Find the second maximum in an array?