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 |
What is the use of pointer in c++ with example?
Find the second maximum in an array?
write a c++ program to create class student having datamember name,Roll_no,age,and branch intilcization all the member using constructor print the all the details on the screen.
class HasStatic { static int I; }; Referring to the sample code above, what is the appropriate method of defining the member variable "I", and assigning it the value 10, outside of the class declaration? a) HasStatic I = 10; b) int static I = 10; c) static I(10); d) static I = 10; e) int HasStatic::I = 10;
Will the following program execute?
What operators can you overload in c++?
Design a program to input a date from user in the form day/month/year (e.g. 2/6/2000) and report whether it’s a valid date or not. The program should take account of leap years. You will need to know that a leap year is a year that is exactly divisible by 4, except that century years are only leap years if they are divisible by 400.
What is struct c++?
write a corrected statement so that the instruction will work properly. if (4 < x < 11) y = 2 * x;
Comment on local and global scope of a variable.
Explain dangling pointer.
What are function poinetrs? where are they used?