Identifier refers to name given to different entities such as constants, variables, structures, functions, etc.

Example

int age;
double mobile_number;

Here age and mobile_number are identifier. int and double are data type.

Rules for naming Identifier

  1. We cannot use keywords as identifier.
  2. The first letter of an identifier should be either a letter or an underscore. An identifier can start with the alphabet, and underscore only. It can’t start with a digit.
  3. No whitespace, commaare allowed within the identifier.
  4. Identifiers are case sensitive.
  5. There is no rule on how long an identifier can be. However, you may run into problems in some compilers if the identifier is longer than 31 characters.

** There is a total of 63 alphanumerical characters that represent the identifiers.

ItemNumber
Capital letter (Uppercase) in the English alphabet26
Small letter (Lowercase) in the English alphabet26
Underscore1
Digit (0-9)10
Total63

Keyword vs Identifier

KeywordIdentifier
Keyword is a pre-defined word.Identifier is a user-defined word
It is a combination of alphabetical characters.It is a combination of alphanumeric characters.
It can only be written in lowercaseIt can be written in lowercase and uppercase letters.
Sharing is Caring
Scroll to Top