Identifiers in C Language

Identifiers in c – an identifier is a string of alphanumeric characters that begins with an alphabetic character or an underscore which are used to represent various programming elements. Example, variables, functions, arrays, structures, unions, etc.

Identifiers are the names given to various program elements such as constants, variables, function names and arrays etc.

Every element in the program has its own distinct name but one cannot select any name unless it conforms to valid name in C language.

Let us study first the rules to define names or identifiers.

Rules for Forming Identifiers

Identifiers are defined according to the following rules:

  1. It consists of letters and digits.
  2. The first character must be an alphabet or underscore.
  3. Both upper and lower cases are allowed. Same text of different case is not equivalent, for example: TEXT is not same as text.
  4. Except for the special character underscore ( _ ), no other special symbols can be used.
  5. For example, some valid identifiers are shown below

Z
Z789
_BY
reset
value_rate

For example, some invalid identifiers are shown below:

456                    First character to be an alphabet.
“Y.”                    Not allowed.
sheet-no            Hyphen allowed.
Same thing         Blankspace allowed.

 

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: