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

How new/delete differs from malloc()/free?

0 Answers  


Which is not a valid keyword a) public b) protected c) guarded

0 Answers  


what is the use of Namespace in c++.

3 Answers  


What is const pointer and const reference?

0 Answers  


Given a simple program designed to take inputs of integers from 1-1000 and to output the factorial value of that number, how would you test this program? You do not have access to the code. Please be as specific as possible.

4 Answers   Microsoft,






What is the difference between cin.read() and cin.getline()?

0 Answers  


Write a struct time where integer m, h, s are its members?

0 Answers  


Describe new operator?

0 Answers  


What is an Iterator class?

1 Answers  


Can inline functions have a recursion? Give the reason?

3 Answers  


What is the purpose of the "delete" operator?

0 Answers  


What is a concrete class?

1 Answers  






Categories