answersLogoWhite

0


Best Answer

constant means data item whose value cannot be altered or change. whereas variable is named storage location whose value can be manipulated during program run.

User Avatar

Wiki User

13y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Difference between variable and constant in terms of memory types?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

What is constant explain their storage representation with suitable example?

A constant is a variable that is immutable. The storage representation is exactly the same as for any other variable of the same type, the only difference is that all constants are allocated in the program's data segment (static memory).


What are the 'Constants' and 'Variables' in Java?

A variable is a memory address that holds a value. A constant is simply a variable that does not change value.


In IT What is the difference between a user variable and a system variable?

A user variable is a memory which is used in specific function or functionality. A system variable is kinda of generic, accessible to all users of the system. It does not bind to specific process as such.


Difference between reference variable and instance variable?

An object is the actual storage space in memory in which some collection of data resides.A reference variable is a variable which refers to the memory location of an object.Look at the pseudocode below:Object obj = new Object();Here obj is the reference variable, and the data to which it refers is the object.


Difference between int a and extern int a. why the first one is definition while the second is declaration please explain?

The declaration 'int a' both declares the variable of 'a' and allocates memory for it. When you use 'extern' you are referring to a variable called 'a' that has its memory allocated in another module. The actual variable 'a' is not in the same compilation unit as the current one being compiled. Where the variable 'a' is located is resolved by the linker. When using 'extern' you state your intent to use a variable called 'a', but it doesn't reserve any memory for it in the current module.

Related questions

What is a variable plus a variable?

A variable is a named memory location for which the contents are volatile. The antonym of variable is constant.


Where is constant variable stored?

Random Access Memory (RAM)


What is constant explain their storage representation with suitable example?

A constant is a variable that is immutable. The storage representation is exactly the same as for any other variable of the same type, the only difference is that all constants are allocated in the program's data segment (static memory).


What are the 'Constants' and 'Variables' in Java?

A variable is a memory address that holds a value. A constant is simply a variable that does not change value.


In IT What is the difference between a user variable and a system variable?

A user variable is a memory which is used in specific function or functionality. A system variable is kinda of generic, accessible to all users of the system. It does not bind to specific process as such.


Difference between reference variable and instance variable?

An object is the actual storage space in memory in which some collection of data resides.A reference variable is a variable which refers to the memory location of an object.Look at the pseudocode below:Object obj = new Object();Here obj is the reference variable, and the data to which it refers is the object.


What is the difference between a regular memory card and an Ultra Memory card.?

What is the difference between a regular memory card and an Ultra Memory card


Difference between multistore and working model memory?

what is the difference between the memory store model and the working memory model?


Difference between int a and extern int a. why the first one is definition while the second is declaration please explain?

The declaration 'int a' both declares the variable of 'a' and allocates memory for it. When you use 'extern' you are referring to a variable called 'a' that has its memory allocated in another module. The actual variable 'a' is not in the same compilation unit as the current one being compiled. Where the variable 'a' is located is resolved by the linker. When using 'extern' you state your intent to use a variable called 'a', but it doesn't reserve any memory for it in the current module.


What is the difference between object and variable?

A variable basically holds a single type literal in memory through defining its type, declaring it, and setting a value to it. If you meant reference variables, they are variables which refer to the memory location of an object previously set.An object is the actual storage space in memory in which some collection of data resides (is stored). Objects 'live' in memory spaces known as 'heaps'.


What is the difference between a variable and a constant?

A constant cannot be changed by the program while it is running. Furthermore, it does not take up any memory on the stack or in the heap, as it is inlined into the compiled code during the compilation process. They are used to represent unchanging data, such as the value of PI, or the date that a particular function was written. A variable is a memory location or register value that may be modified during the execution of the program, and represents data that is unknown until the program runs. Examples might include today's date, the number of times the user has logged in, or the user's preference in colors.


The difference between the literals operands and the immediate operands?

Literal is a constant that is written as a part of the instruction. It avoids storing a constant in the memory and using a label for it in the instruction.the assembler generates the specified value as a constant at some other memory locatin.the address of the generated constant is used as the target address for the machine instruction. with immediate addressing, the operand value is assembled as a part of the machine instruction