answersLogoWhite

0


Best Answer

A literal is a value that can be assigned to a constant or a variable.

A constant is a named memory address in which only one value can be stored. The value must be assigned at compile time and cannot change at runtime.

A variable is a named memory address in which any binary value can be stored. Variables can be initialised at compile time but can change value at runtime.

Examples:

int i = 42; // assign the literal value 42 to the variable i.

const float pi = 3.14; // assign the literal value 3.14 to the constant pi.

char c[] = "Hello world"; // assign the string literal to the character array c.

User Avatar

Wiki User

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

Wiki User

11y ago

A literal and a constant are essentially the same thing. The only real difference is that a constant is defined once (much like a local variable) whereas a literal is defined every time it is used. As a result, prevalent use of the same literal will increase code size. However, modern compilers will pool literals and replace them with constants wherever it is beneficial to do so.

This answer is:
User Avatar

User Avatar

Wiki User

14y ago

the letters and pronunciation. may be this is in englishcontext.. but in computer science context -->a literal is a constant text/numbers like "123", "apple" and "abc123" etc. where as a figurative constant is a symbolic representation of the constant like PI, max-number,high-values,low-value and MESG, etc which represent 3.14,1500,100,1 and "WELCOME" etc. correspondingly

This answer is:
User Avatar

User Avatar

Wiki User

12y ago

Literals are the symbols whereas the identifiers are the keywords.

Well, no, but an example may help:

12, 1e3, 0x4a, 'a', "Hello\n" -- literals

_debug, n, stdio, main, argc, printf -- identifiers

This answer is:
User Avatar

User Avatar

Wiki User

13y ago

A value is a constant; it wont change. A variable varies; it's usually represented by a letter like x or y, and its value, or the amount it represents, can change.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is the difference between value and variable?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is the difference between a variable and a literal in prgramming?

a literal is a constant value, the difference is a variable can change it's value.


What is difference between variable and constant?

Whether or not you can change its value.


What is the difference between the independent variable and the experimental variable?

the independent variable is changed, and the experimental value measure. So you control the independent variable and change it to measure the results


The difference between fixed and variable inputs?

difference between fixed and variable inputs


What is the difference between a control variable and a control treatment?

A control variable is a factor that is held constant in an experiment to prevent it from influencing the outcome. A control treatment, on the other hand, is a specific group or condition in an experiment that receives no experimental manipulation and is used as a baseline for comparison with the treatment groups.


What is the difference between value type parameters and reference type parameters?

When a variable is passed by value, the function receives a copy of the variable. When a variable is passed by reference, the function receives a reference, or pointer, to the original data.


Difference between nominal and real variable?

A nominal variable is a variable measured in current dollars (the value of the dollar for the specific period discussed), and a real variable is a variable measured in constant dollars (the value of the dollar for the base period). That is, a real variable adjusts for the effects of inflation.


Difference between variable resistor and rheostat?

The difference between a variable resistor and a rheostat is the same as the difference between six and half a dozen.


What the difference between a variable and control?

The difference between a controlled variable and a variable is in their state. A controlled variable is something which is rigid and constant while a variable is liable to change and inconsistent.


What is the difference between dependent variable and independent variable in thesis?

For example in the sraight line equation of y = 2x+6 it is y that is the dependent variable because its value is determined by the independent variable of x


What is the difference between predecrement and postdecrement operator in c?

The order of the operations: --p means: decrement the variable, then fetch the new value p-- means: fetch the old value, then decrement the variable


What is the difference between data and variable?

data type refers to the kind of value that is held by a particular variable. For ex: an int variable contains integer value, a string holds a alpha numeric value etc. variable refers to the name of a value using which we can refer to this value. Ex: public int age = 28; here int is the data type and age is the variable.