answersLogoWhite

0


Best Answer

Globals and statics are both allocated in static memory. Locals are allocated on the stack.

User Avatar

Wiki User

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

Wiki User

11y ago

cashe memory

This answer is:
User Avatar

User Avatar

Wiki User

6y ago

Yes.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Can we declare register variable as global?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

How can you declare global and local variable in pseudocode?

A local variable is a variable declared inside a construct, such as a class or function, while a global variable is a variable declared outside of any construct.


Describe about storage allocation and scope of global extern static local and register variables?

Global Varible: The variable which is declared as "Global" one : having the preveleges to use and access that variable in any class and object( means any where in the program) just like PUBLIC keyword in OOPS concepts. Static Variable : If we declare a variable as Static , then it wont have the permission to access that variable through out the program and u have to use it inside the class or object which u declared itself. All the Best Annapurna


Difference between register variable and automatic variables?

Register variables are stored in register of microprocessor/micro-controller. The read/write access to register variable is the fastest because CPU never need any memory BUS operation to access these variable. Auto variable are stored in stack thus access are much slower. Auto variable can be converted to register by using register keyword before it. It has platform specific limitation. Register variable will work only if free registers are available to hold the variable for a function scope. In case of Microprocessor or microcontrollers having very less number of general purpose registers will never take register variable even if we declare it as register.


How do you declare local and global variables in pseudo code?

Pseudocode is not a programming language (it's specifically intended for human interpretation), so there is no need to declare variables, you simply define them as and when you require them. For instance: Let x = 42 Let y = x * 2


What are the functions of a storage class?

There are four storage class specifiers in C and C++. These are - 1. auto : The storage specifier auto refers to automatic variable declaration. The life of an automatic variable is the time during which its parent function is running. The scope of an auto variable is the function scope. They can be accessed only from their parent functions. Syntax : auto int a; 2. register : A register variable has all the characteristics of an auto variable. The only difference is that auto variable uses the main memory to store data and register uses the CPU registers. 3. extern : This storage specifier is used to declare a global variable. The life of these variables is the time during which the program runs.

Related questions

Where global variable get register?

const


What is the difference between normal variable and register variable in c?

In C/C++ when we declare a variable; e.g int var; for this variable (i.e. var) memory is being reserved in RAM (i.e out side processor). If we declare variable like that; register int var2; for this variable memory is being reserved in register of CPU (i.e. withing processor) But register variables are discouraged because processor has to work with registers..... Note: strictly speaking, storage class 'register' means: dear compiler, you might optimize this variable into register, as I won't ever request its address. But of course, it's up to you to decide.


How can you declare global and local variable in pseudocode?

A local variable is a variable declared inside a construct, such as a class or function, while a global variable is a variable declared outside of any construct.


Describe about storage allocation and scope of global extern static local and register variables?

Global Varible: The variable which is declared as "Global" one : having the preveleges to use and access that variable in any class and object( means any where in the program) just like PUBLIC keyword in OOPS concepts. Static Variable : If we declare a variable as Static , then it wont have the permission to access that variable through out the program and u have to use it inside the class or object which u declared itself. All the Best Annapurna


Difference between register variable and automatic variables?

Register variables are stored in register of microprocessor/micro-controller. The read/write access to register variable is the fastest because CPU never need any memory BUS operation to access these variable. Auto variable are stored in stack thus access are much slower. Auto variable can be converted to register by using register keyword before it. It has platform specific limitation. Register variable will work only if free registers are available to hold the variable for a function scope. In case of Microprocessor or microcontrollers having very less number of general purpose registers will never take register variable even if we declare it as register.


How do you declare local and global variables in pseudo code?

Pseudocode is not a programming language (it's specifically intended for human interpretation), so there is no need to declare variables, you simply define them as and when you require them. For instance: Let x = 42 Let y = x * 2


What will you do in order to share a variable among multiple files?

Almost all High end scripting languages, in order to share a Variable with multiple files, You would have to declare a Global Variable.


What are the functions of a storage class?

There are four storage class specifiers in C and C++. These are - 1. auto : The storage specifier auto refers to automatic variable declaration. The life of an automatic variable is the time during which its parent function is running. The scope of an auto variable is the function scope. They can be accessed only from their parent functions. Syntax : auto int a; 2. register : A register variable has all the characteristics of an auto variable. The only difference is that auto variable uses the main memory to store data and register uses the CPU registers. 3. extern : This storage specifier is used to declare a global variable. The life of these variables is the time during which the program runs.


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 all variables are declared with in the function?

It is not necessary to to declare variables inside the function in C. If you declare a variable inside a function, the variable becomes local for the function and another variable of same name can be declared in any other function, but you can not use the variable declared in other function. When you declare any variable outside the function body then the variable becomes global and can be used in any function of the program. Note: errno is an example for a variable declared outside any function.


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

There are two ways to declare varibles. 1. Locally 2. Globally When you declare a variable locally in any function that means it is only accessible by that function. When you declare a variable globally so it is accessible by all the functions in the program. Declaring variables with static keyword means you are setting its value null.


Is possible to declare a variable in a method and declare it a main?

The same identifier (variable name) may be used for at most one variable in each scope. Each method has its own scope, in addition to the global scope which is accessible from all others. However, each scope would have a different variable than every other scope despite using the same name for it.