Keywords and Identifiers in C

keywords and identifiers in c programming

Token:

The smallest unit in a C programming language is called a token. They are involved in the process of compilation, where a program is converted into smallest units continuing to the stages of compilation. These smallest units converted are known as tokens. There are six different types of tokens:

  • Keywords
  • Operators 
  • Strings
  • Constants
  • Special Characters
  • Identifiers
Token
KEYWORDS

Keywords:

Keywords are reserved words that are assigned with a special meaning in the language. These meanings cannot be changed and hence they cannot be used as variable names if used it will result in an error at the time of compilation. They always specify the type or kind of entity. There are a total of 32 keywords in the C language.

List of keywords:

autodoubleintstruct
breakelselong switch
caseenumtypedefregister
constexternreturnunion
char floatshortunsigned
continueforsignedvolatile
defaultgotovoidsizeof
do if staticwhile
List Of Keywords

These were the list of keywords available in C, they must all be written in lowercase.

Identifiers:

In C language identifiers are the names assigned to the elements in the programs such as the variables, functions, constants, user defined data types etc. As the name specifies, identifiers are used to identify the precise elements of the program. The name of the identifiers should be unique, following the rules below.

Rules:

  • Should only contain alphanumeric characters (a-z, A-Z, 0-9) and underscore (_).
  • The first character of an identifier should start with an alphabet (A-Z, a-z) or underscore (_).
  • They are case sensitive.
  • Keywords cannot be used to name identifiers.
  • There should be no whitespace between characters while naming identifiers.
  • Use of special characters are prohibited.

Difference between keywords and identifiers:

Keywords and Identifiers in C
Keywords And Identifiers

Tabular difference:

KeywordsIdentifiers
Keywords are predefined words.Identifiers are values used to define program elements.
It always starts with a lowercase character.It can start with a lowercase, uppercase or underscore.
Specify type or kind of entity.Identifies name.
Example: char, if, while, for, etc.Example: demo, test1, name_iq, etc.

Character Sets:

A program is a set of instructions which consists of several characters and symbols. These various characters and symbols are present in the character set. Hence, the character set comprises of:

Numbers:

All number starting from 0-9

Letters:

Uppercase letters A-Z

Lowercase letters a-z

Whitespaces:

Blank space

Newline

Special character:
karmwklhMvpOGaEV3ElFJwcjL557qzZAUeJlLV UMUleeCQ8 SizPO6GO3ljR7yeWpGM xnUfDjmr9W59mylr4lYk0USM s67Q

Please write comments or WhatsApp if you find anything incorrect, or you want to share more information about the topic discussed above.

Share Your Love
Default image
Soham Malakar
Hello my name is Soham Malakar am currently pursuing BCA Coding is one of my favorite hobbies. I love to code and an enthusiast to learn different types of programming languages. I love to get intoxicated in the world of technology and video games. A quick learner possessing better results.
Articles: 36

Newsletter Updates

Enter your email address below to subscribe to our newsletter

Leave a Reply