answersLogoWhite

0


Best Answer

It depends on the language. In C and C++, all static variables are zero-initialised at runtime but local variables are not, thus an uninitialised local variable will hold whatever value happens to reside at the memory allocated to the variable at runtime. However, the C/C++ compiler can be configured to warn against using an uninitialised variable.

In object oriented languages like Java there's no such thing as an uninitialised variable. This is because all Java variables are objects so we must pass the initial value to the object's constructor unless the object has default constructor. Attempting to default construct an object that has no default constructor is a syntax error.

User Avatar

Wiki User

7y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Do variables that are declared but not initialised contain garbage values?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

What is the difference between a variable and a constant in computer programming?

a constant remains fixed with any kind if change in variation or the quantity whearas variables vary with certain quantitiesa variable is al location in a memory which holds a piece of data ,it can be represented by anything apart from numbers.whearasa constant can be any numbers or charactersif we talk in refernce with C Language:Variable is the named memory location whose value or you can say whose data can be change during execution of program. Where as Constant is the named memory location who value cann't be changed or whose value is fixed during the execution of the program.Variable's syntax is : data_type variable_name; and Constant's syntax is: const data_type constant_name=value;variable's example: int a; Constant's example is:const int a=28;Variables can be initialize after its declaration where as constants must be initialized at the time of there deceleration otherwise they will take a garbage/junk value.


What is local variables default value?

None. If you don't initialize them, you find garbage in them.


Where should you put your garbage?

In the relevant garbage bin.


How do you dispose the garbage?

dispose the garbage by placing it on the pulan sarawat island and burn it .


What is java all about?

Java is a flexible language that is compiled into bytecodes allowing the same program to run on any system with a Java Virtual Machine. As a language it has memory garbage collection, type safe variables, object orientation from the ground up, and lots of supporting libraries and infrastructure.

Related questions

What is the difference between a variable and a constant in computer programming?

a constant remains fixed with any kind if change in variation or the quantity whearas variables vary with certain quantitiesa variable is al location in a memory which holds a piece of data ,it can be represented by anything apart from numbers.whearasa constant can be any numbers or charactersif we talk in refernce with C Language:Variable is the named memory location whose value or you can say whose data can be change during execution of program. Where as Constant is the named memory location who value cann't be changed or whose value is fixed during the execution of the program.Variable's syntax is : data_type variable_name; and Constant's syntax is: const data_type constant_name=value;variable's example: int a; Constant's example is:const int a=28;Variables can be initialize after its declaration where as constants must be initialized at the time of there deceleration otherwise they will take a garbage/junk value.


What is local variables default value?

None. If you don't initialize them, you find garbage in them.


How are lysosomes like a garbage collector?

how is the lysosomes like a garbage truck


How Garbage collection flows and What is a heap memory?

Well, when you make an object, it is stored on the "heap". When that object has no reference variables, it is found by the garbage collector and deleted.


What structures is likely to contain food material or waste?

The garbage bin


What is the value of the un initialized pointers?

Random garbage, obviously. Let's note that global (ie not automatic) variables are automatically initialized by zero (=NULL)


Garbage man pay rate in Louisiana?

The salary range for a garbage man in Louisiana is anywhere from $17,000 to approximately $28,500. Please keep in mind that salary may vary due to experience in the field, education, geographic location and other variables.


Can empty milk containers into the garbage disposal?

No. The cardboard in milk cartons contain plastic, and your disposal won't enjoy the cardboard.


What do you put in the garbage?

Garbage. You put Garbage in the Garbage.


What do the letters GIGO stand for?

garbage in, garbage out.. it also a famous underware brand garbage in, garbage out garbage in, garbage out


What are garbage ants?

There are two types of garbage ants; the blue and red garbage ants. The red garbage ants collect garbage, while the blue garbage ants produce garbage.


How can you make garbage a plural noun?

The noun garbage is an uncountable noun; units are expressed as a lot of garbage, some garbage, a little garbage, a can of garbage, a barge of garbage, etc. The noun garbage is a concrete noun as a substance. The noun garbage is an abstract noun as a concept.