Skip to main content

Variables / Identifiers / Literals (Constants)

Variables

These are the memory location which can store a value. As the name suggests, the value of a variable can vary during the whole program.

In other words, variables are named storage locations whose value can be manipulated during program run.


Example: 

a = 5;  ✔

5 = a;  ✖

a = a + 2;

a = a + 10;

Identifiers

Name of variable, function, array, class etc created by the programmer are called as identifiers.

Constants

Data items that never change their value during a program run.
  • integer constant
  • character constant
  • floating constant
  • string-literal

Comments