Keywords and Identifiers in C


Every C word is classified as either as keyword or an identifier.

Keywords : keywords are reserved words that have predefined standard meaning in C i.e., the meaning is already defined.

  • Keywords can not be used as identifiers.
  • Keywords depends on th compiler used for compiling the program.
  • All keywords must be written in lowercase letters.
  • The meanings of the keywords cannot be changed.
  • Keywords server as basic building blocks for program statements.
  • In ANSI C, there are 32 keywords.
Examples :
int a = 20; Here int is a keyword.
while(i < 10); Here while is a keyword.

Following are some of the standard keywords.

Keywords and Identifiers in C

Identifiers : Identifiers refer to the names of variables, functions and arrays, which are defined by the users.

Rules for Identifiers :

  • Identifiers consist of a sequence of letters or alphabets(a to z or A to Z), digits (0 to 9) or underscore(_)
  • No special symbols are allowed except underscore.
  • The first character always must be an alphabet or underscore, but it should not be a digit.
  • Both uppercase and lowercase letters are permitted.
  • Length of an identifier depends on he version and the computer used.
  • Identifier length is up to 8 characters for 16 bit machine and up to 31 characters for 32 bit machine.
  • No two successive undercovers are allowed.
  • Keywords cannot be used as identifiers.
  • Mo commas or blanks are allowed with in variable name.
    Valid Identifiers : volume, y12, _sum, pop_e_89.
    Invalid Identifers : 2abc, reg.no, "z", pop_ _e89, 3rd
0 Komentar untuk "Keywords and Identifiers in C"

Back To Top