Keywords and Identifiers in C

Each of the C program is a collection of instructions and even every instruction is a collection of some individual units. These individual smallest unit is known as tokens. Every instruction in a c program is a collection of tokens and they are the basic building blocks of any c program.

In a C program token may contain the following:

In a C program, collection of all keywords, identifiers, operators, special symbols, constants, string , and data values are called tokens.

Keywords:

  • Keywords are like reserve word in c with a predefined meaning which is already known to the compiler.
  • There are total 32 keywords in C.
  • They are also known as reserved words.

Properties of Keywords:

  • All the keywords in C programming language are defined as lowercase letter.
  • They cannot be used for naming a variable, function, array , pointer etc.
  • Some predefined function associated with each keywords and this cannot be modified.

Keyword in C:

Identifiers:

  • Identifiers are name given to variables, constant, functions and user-defined data such as array, pointer, structure, etc.
  • In other words it can be defined as the user-defined name to identify an entity uniquely in the C programming language.

These identifiers must follow certain rules, those are as follows:

  • An identifier can only have alphanumeric characters(a-z, A-Z, 0-9) and underscore(_).
  • The first character of an identifier can only contain alphabet(a-z, A-Z) or underscore (_).
  • They are case-sensitive that is “name” and “Name” are two different identifiers.
  • No special characters, such as a semicolon, period, whitespaces, slash, or comma are permitted to be used in or as an Identifier.

Example:

int var;
here “int” is a keyword and “var” is an identifier.



Categories: C Language

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: