answersLogoWhite

0

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

10y ago

What else can I help you with?

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 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.


WAP to show the difference between a variable and static variable?

difference between constant and static variables in java