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

If all is successful, what should main return a) 0 b) 1 c) void

0 Answers  


What's the "software peter principle”?

0 Answers  


Do you know what are the new features that iso/ansi c++ has added to original c++ specifications?

0 Answers  


Badboy is defined who has ALL the following properties: 1. Does not have a girlfriend and is not married. 2. He is not more than 23 years old. 3. The middle name should be "Singh" 4. The last name should have more than 4 characters. 5. The character 'a' should appear in the last name at least two times. 6. The name of one of his brothers should be "Ram" Write a method: boolean isBadBoy(boolean hasGirlFriend , boolean isMarried, int age , String middleName , String lastName , String[] brotherName); isHaveGirlFriend is true if the person has a girlfriend isMarried is true if the person is married age is the age of the person middleName is the middle name of the person lastName is the last name of the person brotherName is the array of the names of his brothers

1 Answers  


Is map thread safe c++?

0 Answers  


What are default parameters? How are they evaluated in c++ function?

0 Answers  


What are manipulators used for?

0 Answers  


What do you mean by early binding?

0 Answers  


What is function prototyping?

0 Answers  


Can a constructor throw a exception? How to handle the error when the constructor fails?

1 Answers  


Explain the difference between overloading and overriding?

0 Answers  


What are the rules about using an underscore in a c++ identifier?

0 Answers  


Categories