Identifiers of C Programming Languages

4596

In any programming language developer must know how to name an identifier. An identifier (in a programming language) is a combination of alphanumeric characters, the first being a letter of the alphabet or an underline, and the remaining being any letter of the alphabet, any numeric digit, or the underline. In other words, it presents the names that are given to various program elements such as variables, symbolic constants, functions and data definition, etc.

Rules of identifiers in c

To be declared identifiers programmers must keep the following point in his mind:

  • Alphanumeric characters (a ~ z , A~Z , 0~9) and half underscore ( _ ) can only be used.
  • The first character of the first contain letters (a ~ z, A~Z) or half underscore (_) can only be used.
  • Language is Case sensitive or distinguishable. It means that the compiler of the language recognized ‘word’ and ‘WORD’ as separate identifiers.
  • Reserved words or special characters are not allowed to declare as identifiers. However, part of an identifier reserved words can be included.

Note: In the case of some compilers, a dollar sign ($) is permitted in the identifier name but not as the first character of an identifier. It should be pointed out that even though a dollar sign may be permitted by your C compiler, it is not used anywhere in this tutorial since it is not in general use by C programmers, and is not even allowed by most compilers. If you do not plan to write any portable code, you can use it at will if you feel it makes your code more readable.

Point to remember while mentioning identifiers in c

List of Rules and restrictions by programming language C that are needed to know before mentioning an identifier:

  • The identifier name must be a sequence of letters and digits and must begin with a letter.
  • The underscore character (‘_’) is considered as a letter.
  • Names shouldn’t be a keyword (such as int, float, if, break, for etc.)
  • Both upper-case letter and lowercase letter characters are allowed. However, they’re not interchangeable.
  • No identifier may be the keyword.
  • No special characters, such as semicolons, periods, blank spaces, slashes, or commas are permitted.
  • Programming language C is defined; up to 32 significant characters can be used and will be considered significant by most compilers. Due to that if more than 32 are used, they will be ignored by the compiler.

Examples of Legal identifiers in C

  • float a;
  • int this_is_a_very_detailed_name_for_an_identifier;

Examples of Illegal identifiers in C

  • float :e;
  • float for;
  • float 9PI;
  • float .3.14;
  • float 7g;

You got about what is Identifiers in C programming language and detail information about rules and restrictions regarding the name identification of the Identifiers in programming languages.

Attempt Free C Programming MCQ Quiz

Previous articleRole of PPL-Reasons of studying Principle of Programing Language
Next articleKeyword in C Programming Language – definition and examples
Er Parag Verma
Hello I am Er Parag Verma. I am tech blogger, Professor and Entrepreneur. I am on the mission to change the pattern of learning to make it easy, valuable and advance.

1 COMMENT

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.