answersLogoWhite

0

Yes. If a variable does not represent a global concept then it has no business being declared global. Local variables and argument passing make code easier to read and maintain because access is limited only to those functions that actually require access.

User Avatar

Wiki User

10y ago

What else can I help you with?

Related Questions

What are the variables according to function?

Variables according to function refer to the different types of variables in programming and mathematics that serve specific roles within a function. These include independent variables, which are inputs that can be changed, dependent variables, which are outputs that depend on the independent variables, and constant variables, which remain unchanged throughout the function. In programming, local variables are defined within a function's scope, while global variables are accessible throughout the entire program. Understanding these roles helps in structuring functions effectively for various applications.


How do you create a global variable in a program?

1.In computer programming, a global variable is a variable that is accessiblein every scope.2.There are some variables that are used in more than one function.suchvariables are called global variables.3.Usually,they are declared in global declaration section that is outsideof all functions.4.In this section,we can also declare all user-defined functions.DECLARATION:int global =5;


Why there are no global variables in java?

Global variables are globally accessible. Java does not support globally accessible variables due to following reasons:The global variables breaks the referential transparencyGlobal variables creates collisions in namespac


Do threads share global variables?

No, threads do not share global variables by default. Each thread has its own copy of global variables, which means changes made to global variables in one thread do not affect the values in other threads.


Why use of external variables is discouraged?

External variables, or global variables, are generally frowned upon because any code with access to the variables can alter the variables in unexpected ways. Object oriented programming addresses this problem by allowing programmers to encapsulate those variables into an object (often a singleton object) which provides far greater control over how those variables may be altered.


What is the other name of global variables?

Another name of global variable is "EXTERNAL VARIABLES".


What are global variable?

Variables that are declared globally outside every program are called global variables.


What are local variables and global variables?

Local variables: These variables only exist inside the specific function that creates them. They are unknown to other functions and to the main program. As such, they are normally implemented using a stack. Local variables cease to exist once the function that created them is completed. They are recreated each time a function is executed or called. Global variables: These variables can be accessed (ie known) by any function comprising the program. They are implemented by associating memory locations with variable names. They do not get recreated if the function is recalled.


What variables are useful for establishing two-way communication between modules?

In programming, the best way to establish two-way communication between modules is to use global variables. These variables will apply throughout the program. Just make sure to declare them before establishing the main module.


Why there are not local and global controls in visual basic programming?

There are, you can either use "Dim" or "Public" when declaring variables to allow them to be used either in the local Sub or throughout the whole program.


What is a logical use for global variables?

Storing global data.


What are the differences between global variables and local variables in C plus plus?

Global variables can be seen in all blocks of your program, when local variables are visible only within the block where it's declared.