Wednesday 29 November 2017

IDENTIFIERS in C Programming

  • The elements of a program are named with a specific name called as Identifiers.
  • Identifiers used to identify the variables, functions, pointers and some user-defined datatypes.
  • Identifiers in a program are unique.
    • Ex: int mark;
  • Here mark is an identifier.
  • There are some rules for the Identifiers.

Rules for Identifiers:

  1. The name of an Identifier always starts with an alphabet or underscore ( _ ).
  2. It must not be a keyword.
  3. There mustn't have any space in between any alphabets.
  4. Identifiers are case sensitive.
  5. Punctuation and special characters aren’t allowed except underscore.
  6. It may be the combination of alphabets and digits, but the 1st letter must be an alphabet. 

Example of Identifiers:

int x;
float percentage;
double simple_interest;
string name1;
string name2
int _number2;
  • Here x, percentage, simple_interest, name1 and name2 are the identifiers.
  • Identifiers may be a single character, word, combination of word and number.
  • The name of identifier must start with alphabet, but we could use _ from the symbols.

No comments:

Post a Comment