C IDENTIFIERS AND VARIABLES – A BRIEF DESCRIPTION

C IDENTIFIERS AND VARIABLES

C IDENTIFIERS AND VARIABLES – A BRIEF DESCRIPTION

C IDENTIFIERS

In C Language, C Identifiers are the names given to different entities such as variables, functions, labels, arrays, structures, etc.

C Identifiers can vary from one to several characters. Generally, in a layman’s language we can say that..

C Identifiers are the words which a user defines for different entities such as variables, arrays, functions, structures, labels, etc.

Furthermore, C Identifiers may be of any length in a C program. However, not all characters will necessarily be significant. Why!? Because if we involve the identifier in an external link process, then at least the first_6_characters will be significant only. These Identifiers will be the external names i.e. these include function names and global variables share between files.

Also, if there’s no use of C Identifier in external link process then at least the first_31_characters will be significant. These Identifiers will be the internal names and these includes the names of local variables. One more important point is that in an identifier, the compiler considers UPPERCASE​ and LOWERCASE as distinct. That means, if there are 3 Identifiers number, Number and NUMBER, then these 3 are seperate Identifiers.

GENERAL RULES FOR NAMING C IDENTIFIERS ARE

  • The Identifier name should consist of only alphabets(both UPPERCASE and LOWERCASE), digits and underscore sign( _ ).
  • The first character should be an alphabet or underscore.
  • The Identifier name should never be a keyword.
  • Since C is a Case sensitive language, the compiler considers the UPPERCASE and LOWERCASE letters different. For example, code, Code and CODE are three different Identifiers.
  • An Identifier name may be arbitrarily long. Some implementations of C recognise only the first eight characters and most implementations recognise 31 characters.

Generally, ANSI standard compilers recognise 31 characters. The Identifiers are generally meaningful names.

Some examples of valid identifier names are :

  • Number
  • marks
  • Student_name
  • Arr1
  • DATA
  • _id

Some examples of invalid Identifier names are :

  • 2Name

The first character should always be an alphabet or underscore..

  • float

float is a keyword and we should never use a keyword as an identifier name..

  • ID@

@ is a special character, thus we it will be invalid to use..

  • Mukul Bhatt

There should be no blank space between the Identifier name. The user can also write the name as Mukul_Bhatt..

GENERAL SYNTAX FOR DECLARING AN IDENTIFIER –

Data_type Identifier_name;

Above given is the general syntax for declaring an identifier in a C program. First of all, the data_type i.e. usually chosen by the user that may be int, char, float, long, double, etc. Furthermore, the user provides a meaningful name to the data_type i.e. the Identifier_name. The Identifier_name is in-total user’s choice.

FOR EXAMPLE :

  • int marks;
  • float VALUE;
  • char Grade;

Thus, this was all about C IDENTIFIERS.. Now after C IDENTIFIERS, it’s time for another C ELEMENTS i.e. C VARIABLES..

Leave a comment

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

12 thoughts on “C IDENTIFIERS AND VARIABLES – A BRIEF DESCRIPTION”