C – Rules for Naming Identifier in C

C - Identifiers, Rules for Naming Identifiersbe mine_

Identifier in C

Identifiers in the C programming are defined elements like the name of variables, function arrays, structures, etc, They are the fundamental requirement of any language.

These are token which is composed of a sequence of letters, digits, and underscore ( _ ).

Every language has its own rules for naming identifiers. Identifiers are used to give unique names to different objects in the program.

Rules For Naming Identifiers in C

  • An identifier is any combination of alphabets, digits, or underscores. 
  • The first character in the identifier name must be an alphabet and not a digit but after that, any digit may follow. 
  • No blank (white space) is allowed within an identifier. 
  • No special symbols other than underscore(as in stn_name) can be used in an identifier. 
  • A maximum length of an identifier is compiler dependent. Originally it was 8 characters. ANSI C permits 31 characters in identifiers. 
  • Upper case and lower case letters are distinct. 
  • A keyword cannot be used as an identifier. 
  • The identifier name should be unique. 
  • The Same Identifier cannot be used again to give the name to another object.

C Identifier Example

Following are some possible examples of identifiers to represent the length of the box;