Keywords and Identifiers


Keywords:

Keyword is a word in C language that has predefined meaning and purpose. The meaning and purpose of a keyword is defined by the developer of the language. It cannot be changed or redefined by the user. Keyword can be used for the same purpose for which it is defined. They help the compiler in compilation process. Keywords are written in lowercase.

Keywords are also known as reserved words. There are different types of keywords in C programming language. The total number of keywords in C programming language is 32.


List of keywords:

The following is the list of keywords in C programming language:

auto double int struct
break else long switch
case enum register typedef
char extern return union
const float short unsigned
continue for signed void
default goto sizeof volatile
do if static while


Identifiers:

The identifiers are the names used to represent variables, constants, types, functions and labels in the program. Identifier is an important feature of all computer languages. A good identifier name should be descriptive but it should be short.


Rules for Identifiers:

The following are some important rules for naming identifiers:

  1. The first character must be an alphabet or an underscore (_).
  2. The identifier name must consist of only alphabetic characters, digits and underscore (_).
  3. The reserved words cannot be used as the name of identifiers.
  4. Special characters are not allowed such as semi colon, period, comma, etc are not allowed in the name of identifier.


Types of Identifiers:

In C programming language there are two types of identifiers:

  1. Standard Identifiers
  2. User defined Identifiers

Standard Identifiers:

A type of identifier that has special meaning in C programming language is known as standard identifier. C programming language cannot use a standard identifier for its original purpose if it is redefined.

User defined Identifiers:

A type of identifier that is defined by the programmer to access memory location is known as user defined identifier. The user defined identifiers are used to store data and program results.

Example of identifier:

A name of variable that is defined by the user can be given as an example of identifier for example int a, float avg.


Character Set:

The characters in C programming language can consist of following: letters, digits, special characters and whitespaces. Special characters include semicolon, comma, period, etc.