Identifiers in C Programming

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

Identifiers must be unique. They are created to give a unique name to an entity to identify it during the execution of the program. For example:

int money;
double accountBalance;
Here, money and accountBalance are identifiers.

Also remember, identifier names must be different from keywords. You cannot use int as an identifier because int is a keyword.

Rules for naming identifiers:-

  • A valid identifier can have letters (both uppercase and lowercase letters), digits, and underscores.
  • The first letter of an identifier should be either a letter or an underscore.
  • You cannot use keywords as identifiers.
  • 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.
  • You can choose any name as an identifier if you follow the above rule, however, give meaningful names to identifiers that make sense

Comments

Popular posts from this blog

Keywords in C Programming

Definition of C Language

Data Types in C Programming