answersLogoWhite

0


Best Answer

A local variable is a variable that can only be called on by the module. Where as a global variable can be called upon by any module. Only statements made inside the same module can call on a local variable.

User Avatar

Wiki User

11y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

9y ago

Local variable is a variable having local scope. Local variable has higher priority than global priority.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is a local variable and What statements are able to access a local variable?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Which is the keyword used to access the variable declared as global variable in another file?

To be able to access a variable declared in one file/class from another file/class you need to declare that variable as "public". Doing this is a very bad coding practice because exposing a variable of a class to be available publicly to other classes is totally against the Java object oriented concepts of Encapsulation and Data hiding. So, preferably you shouldn't be doing this. However, a better way to do this is, declare the variable as private and have public accessor methods through which you can access this variable. This will ensure that your data is protected even if it is available outside the class


What are the synchronized methods and synchronized statements in java?

Synchronized Methods are methods that have the keyword synchronized in the method signature. Synchronized statements are pieces of java code that are surrounded by brackets which have the keyword synchronized qualifying them. Both cases mean that - only one thread will be able to access the method or the statement that is synchronized


why we use variable speed drivers in motor control units?

Variable speed drivers are necessary to be able to have different speed settings in a motor.


Explain the scope and visibility of variables in c plus plus function?

If you define a variable inside of your function, the variable can be referred and used only inside of that function. It means that you will not able to use the variable in another function (including main). Area of code where your variable can be used after declaration is usually called visibility of the variable.


What is the difference between static global and local global variable?

First, lets speak about the scope of a variable. The scope of a variable is the section of the application that can see and manipulate that variable. If the variable is declared in a procedure when that procedure is called, only that procedure can use that variable. Hence that variable is considered "Local". Now Static. Static variables are variables that are created with the static key word as in:- function ab(var1 as integer)as integer static iTotal as integer itotal =iTotal + var1 (rest of ccode goes here) end function Now when this function is called the first time, iTotal will be assigned the value of var1. The next time the function is called, iTotal will retain the previous value and the new value of var1 will be added to it. Hope this helps. (theTeacha) Static variables life time is not under any scope.It initializes only one time from creation to delete.let me explain by a pgm. void main() { int a=1; static s=1; int k=0; for(k=0;k<1;k++) { i++; s++; main(); } printf("%d is i",&i); printf(%d is S",&s); getch(); } Output will be 2 is i 3 is s It Shows that local variable initialize every time the function call.But Static variable initializes only once <><><> For a variable, static means it keeps its value even when the enclosing code is not active--out of scope. A static variable is assigned to a fixed memory location when the program runs, so it is possible to examine a static variable at any time the program is active, even when the function where the var is declared is not active. A local variable is dynamically allocated storage space when a function is called, and its storage is given up when the function ends, so it only exists while the function is executing. For a function, static declaration means it can only be called from functions in the same file (in C).

Related questions

How are global variable different from local variable in Visual BASIC?

A global variable is available for use throughout the program. It is normally declared outside any procedure. A local variable is only available for use in the procedure it was declared in. Most variables are local, but there will be occasions when you want different procedures to be able to use the same variable. This is when you use a global variable.


Can you tell you the specifics of Capital One online banking?

If you have an online Captial One bank account, you will be able to access your account online and quickly and easily pay bills, and have access to tools such as account transfers, check images, statements and much more. You can learn more by visiting your local Capital One bank or checking their web site.


What is the prefix for variable?

In programming, the term "prefix" typically refers to a naming convention that precedes the name of a variable. Common prefixes include "int" for integer variables, "str" for string variables, "bool" for boolean variables, and so on. These prefixes help developers quickly identify the data type of a variable.


What rhymes with variable?

variable matrices algebra error


Which is the keyword used to access the variable declared as global variable in another file?

To be able to access a variable declared in one file/class from another file/class you need to declare that variable as "public". Doing this is a very bad coding practice because exposing a variable of a class to be available publicly to other classes is totally against the Java object oriented concepts of Encapsulation and Data hiding. So, preferably you shouldn't be doing this. However, a better way to do this is, declare the variable as private and have public accessor methods through which you can access this variable. This will ensure that your data is protected even if it is available outside the class


What are the synchronized methods and synchronized statements in java?

Synchronized Methods are methods that have the keyword synchronized in the method signature. Synchronized statements are pieces of java code that are surrounded by brackets which have the keyword synchronized qualifying them. Both cases mean that - only one thread will be able to access the method or the statement that is synchronized


What is the answer to 10x-11-11 or 4x plus 618?

x is a variable which means it can take any value. If we do not know what either of these statements is equal to (i.e. if they are not able to be written in the form of an equation) then we can not solve for a specific value of x.


Where might one find a local insurance underwriter?

Your local telephone directory will have listings for all aspects of insurance. If you experience difficulty or cannot access a telephone directory, your local telephone operator should be able to offer assistance.


Are prison records available to access online?

Buy computers at public auction from the jurisdiction that you are interested in researching. You may be able to call or access prison records by going to the local police or sheriff websites.


Can I find TV guide listings online?

You will be able to access local and national TV listings at www.tvguide.com. You will need to register an account which includes supplying your location and cable provider to access every listing.


What statements about Oceania when comparing is with other world regions is correct?

We would need to see the statements to be able to answer this question.


How do you use substitution to solve equations?

You plug in what the variable is equal to for that variable then you will be able to finish the problem