/* */ Click to Join Live Class with Shankar sir Call 9798158723

C Identifiers ?


It is a collection of alphabets, special characters underscore which are represent or use to write various programming elements. Such as : variable, function, array, structure, union, labels are known as C identifier.

Whatever we use to write C program is known as identifier. Identifier name must differ in spelling as case from any keyword. We cannot use keywords as identifier.


Example:-


#include<stdio.h>
int main()
{
int a=5;
printf(“%d”, a);
}

In this example ‘a’ is an identifier as an integer variable and main and printf are identifier names for function.


Types of Identifiers:-

  1. Internal Identifiers:-Internal variable can be local variable, if the identifier is not use in the external linkage, then it is known as an internal Identifier.
  2. External Identifiers:-If the identifier is used in the external linkage then it is known as an external identifier, it may be function name or global variable.

Reasons for invalid identifiers:-

  1. It must begin with alphabets or _.
  2. It should not be a keyword up to 31 character long.
  3. Only alphabets, numbers, _ (underscore) can be used.
  4. No other punctuation and special symbols are allowed.

Example:-

C invalid identifiers
2total(it starts with number.)
int (int is a keywords.)
m-n (special character is not allowed.)


Difference between Keywords and identifiers:-

Keywords Identifiers
Keywords have pre-defined meaning in a language. They are used for specific purpose. Identifiers do not have pre-defined meaning in a language.
Keywords have pre-defined meaning in a language. They are used for specific purpose. Identifiers do not have pre-defined meaning in a language.
Keywords have pre-defined meaning in a language. They are used for specific purpose. Identifiers do not have pre-defined meaning in a language.

Note: We cannot take identifier as an user define function, array, union, struct name.