Identifiers in C

  • February 5, 2022
  • C
Matrix multiplication

Identifiers in C are the basic building block of a program. As the name suggests, they are used to identify user-defined objects. For instance, variables, functions, arrays, structures, unions, labels, etc.
An identifier starts with a letter A to Z, a to z, or an underscore ‘_’ followed by zero or more letters, underscores, and digits (0 to 9).

Rules for composing an identifier in C:
  • Identifiers can have alphabets, digits, and underscore characters.
  • C does not allow punctuation characters such as @, $, and % within identifiers.
  • They must not be a keyword.
  • They must not begin with a digit.
  • Identifier length should not be more than 31 characters.
  • C is case sensitive in nature i.e., upper-case letters and lower-case letters are different.
  • Assign indicative names that make sense.

We can create any name as an identifier by following the given rules. Let’s take a look at some examples.

Valid identifiers examples:
variable1   app_2  _xyz  _XYZ  Rst sum1
Invalid identifiers example:
23a @var !$b 09xy
Some facts about identifiers:
  • Not all identifiers are variables.
  • It is created to give a unique name to an entity.
  • Identifiers are tokens.
  •  Once declared, we can use the identifier in the later program.

Note: Also read about  C Program – Structure & Keywords in C.

Follow Me

If you like my post please follow me to read my latest post on programming and technology.

Leave a Reply

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