answersLogoWhite

0

Default value of register variable

Updated: 11/2/2022
User Avatar

Wiki User

13y ago

Best Answer

If you don't initialize it, you will find random garbage in it. (The same is true for auto class.)

User Avatar

Wiki User

13y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Default value of register variable
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is the default value of register storage class?

Register storage class is a compiler hint that the variable will be often used, and that it should generate code, if it can, to keep the variable's value in a register.


What is default value of Boolean type variable?

False will be the default value of the boolean datatype in java


What value is assigned to extern variable?

Default initial value of extern integral type variable is zero otherwise null.


What is class register?

Register storage class is a compiler hint that the variable will be often used, and that it should generate code, if it can, to keep the variable's value in a register.


Default value for instance variable?

Depending on the language you are using the default of an instance variable can be '0', 0, null, empty, '', or have a random number.


What is the function of default values in java?

Default values are available for any class or instance variable. If you do not specify a value for a class or instance variable the JVM will provide a default value that will ensure that the system does not end up with any unexpected errors because you used a variable that was not initialized. Ex: Public class Test { int I; } In the above class we have just declared an instance variable called 'I' but we haven't associated any value to it. The JVM automatically assigns 0 as the default value to this variable.


What is the initial value of a numeric variable?

When we talk about instance variables, the default initial value for a numeric variable is always '0'. Any other variable in your code must be initialized before you can use it. public class MyClass{ public int x; // 0 by default public float y: // 0 by default public MyClass{ int z; z++; // Error 'z' don't have a default value } }


What is the by default value of globally declaration variable?

int, float: 0 pointer: NULL


What is the initial value of (-1-17) and (-3-15)?

When we talk about instance variables, the default initial value for a numeric variable is always '0'. Any other variable in your code must be initialized before you can use it. public class MyClass{ public int x; // 0 by default public float y: // 0 by default public MyClass{ int z; z++; // Error 'z' don't have a default value } }


What is static char in C?

static storage class in C tells that: The variable will have the default value as zero. The variable scope will be the file in which it is defined. RaVi


What does a Java Boolean type variable declared but not yet initialized contain when its class is instanciated?

If it is a class or instance variable, it gets the default value of false. If it is a local variable (inside a method), it doesn't have a value until you explicitly set one.


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.