The scope or the life span. The life span is from the birth (allocation) to death (deallocation).
The life span of a global variable starts when the application is invoked. It dies when the application terminated. During the execution of the application , this global variable is available to any program unit within that application.
The life span of a local variable, well, only locally. "Local" means a component, a method (subroutine), or even within a bracket ({} or BEGIN-END) of a statement.
Outside of that block of codes, that local variable does not exist, hence cannot be accessed or referenced. Also, the same name of that local variable may be declared again in another local area without conflict, nor memory of the previous one.
For languages similar to C:
for (int i = 0; i < 100; i++)
{
// i can be referenced within { }, and within the for() control itself
}
for (int i = -1; i > -200; i--)
{
// this i is different from the i in the previous for-loop
}
Some computer language would allow you to declare a local variable with the same name as the global one (for example, there are global::X and local::X, but the code only refer as X). Most of the computer language would replace X with local::X at compile time, some would replace it with global::X) Some languages may not have the notion of local variables, everything is global, and some would not have the notion of global variable, but would provide a mean to act like one.
essential diffrence between global and local optimization
that they are not the same thing
they aren't.
Global would be advertising in many different countries, while Local advertising would be in a certain city or district.
A local revision focuses on specific words, phrases, and sentences; a global revision addresses larger aspects of the work.
the notion that what happens at the global scale has a direct effect on what happens at the local scale, and vice versa. this idea posits that the world is comprised of an interconnected series of relationships that extend across space. Source: Human Geography: People, Place, and Culture, 8th Edition
global memory it is decide outside of your scope and we can access it in all of your scope
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.
I assume that "local" navigation is navigation affordances that are available on one web page, but not others. Global navigation appears on every page of a web site. Usually found in the form of a bar at the top of the page with all the major parts of the site reflected.
Global winds are local winds.
Local media focuses on news and events within a specific region, while global media covers events on an international scale. Local media often provides a more detailed and in-depth analysis of local issues, while global media offers a broader perspective on worldwide events. The relationship between the two can help audiences understand how local events are interconnected with global issues.
True, a variable cannot be both global and local. But if a global and a local variable share the same name, the local one will hide the global.