Identifiers and Keywords in C

Identifier

Identifiers are names given to variables, constants, arrays, functions, and objects. These are user-defined names and consist of a sequence of letters, digits, and underscore with a letter or underscore as the first character. The underscore is usually used as a link between two words in long identifiers. There are certain rules for identifiers they are.

  1. The first character of an identifier must be an alphabet or underscore.
  2. Must consist only letters (A-Z and a-z), digits (0-9), and underscore.
  3. It can’t use keywords.
  4. It can’t contain white spaces.
  5. As per ANSI-C, only the first 31 characters are significant.
  6. Identifiers are case-sensitive. i.e. Name and name are two different identifiers.

Let’s see some valid identifiers name: variable, variable123, variable_one, _variable, _123variable, variableint

Some invalid identifiers name: int, 123variable, 1234

Keyword

Keywords are reserved words that have special meaning in C Language. The meanings can not be changed. Keywords serve as a basic building block of C programming statements. The list of available keywords as per ANSI C is listed below.

auto doubleintstruct
breakelselongswitch
caseenumregistertypedef
charexternreturnunion
constfloatshortunsigned
continueforsignedvoid
defaultgotosizeofvolatile
doifstaticwhile
Table: ANSI C keywords