Friday, January 26, 2024

kEYWORDS & IDENTIFIERS IN C

KEYWORDS AND IDENTIFIERS





Keywords


Keywords are predefined, reserved words used in programming that have special meanings to the compiler. Keywords are part of the syntax and they cannot be used as an identifier. Keywords are also known as reserved words and we cannot alter the meaning of keywords. Keywords are the basic building blocks for developing C programs.

There are only 32 keywords in standard C and these keywords must be written in lowercase.

Identifier

Identifier refers to name given to entities such as variables, functions, structures etc.

Identifiers must be unique. They are created to give a unique name to an entity to identify it during the execution of the program. 

Rules for Naming Identifiers in C

  • A valid identifier can have letters (both uppercase and lowercase letters), digits and underscores.

  • The first letter of an identifier should be either a letter or an underscore.
  • You cannot use keywords like int, while etc. as identifiers.
  • There is no rule on how long an identifier can be. However, you may run into problems in some compilers if the identifier is longer than 31 characters.


0 comments:

Post a Comment