What are Identifiers and Variables

Identifiers are the names used to represent variable , constant , types , functions and label in the program. Identifier is an important feature of all computer languages. A good identifier name should be descriptive but short.
An identifier may consist of 31 characters. If there is 32 characters is used as identifier than first 31 will be used and other will be ignored by C compiler.
Rules for identifier ::
  • The first character must be an alphabet and underscore( _ ).
  • It must consist of only alphabetic characters, digits or underscore ( _ ).
  • The keywords can not be used as identifier name.
Types of Identifiers ::
  1. Standard Identifiers
  2. User-defined Identifiers
  • Standard Identifier
A type of identifier are the names that has special meaning in C.

Example ::

printf and scanf are the examples of standard identifiers.

  • User-defined Identifiers
A type of identifiers that is defined by the programmer to access memory location. The user identifiers are used to store data and programs result.

Example ::

 Some example for User-Identifiers are a, marks, age, salary etc. (Any but must follow the rules).





Variables is a named memory location or memory cell. It is used to store program's input data and its computational results during execution. The value of the variable can be change. But the name of the variable can not be changed. The variables are created in RAM which is a temporary memory. 

It consist of ::

  1. Name of the variable (It refer an identifier that represent a memory location)
  2. Address of variable (It refer to the memory location of the variable)
  3. Contents of variable (It refer to the value stored in memory location referred by variable)

No comments:

Post a Comment