find and solve ||
Please wait.....

C Tokens, Identifiers, Keywords: What is Tokens & Its Types

What is a Character set?

Like every other language, ‘C’ also has its own character set. A program is a set of instructions that, when executed, generate an output. The data that is processed by a program consists of various characters and symbols. The output generated is also a combination of characters and symbols.

A character set in ‘C’ is divided into

  • Numbers
  • Special characters
  • White spaces (blank spaces)

A compiler always ignores the use of characters, but it is widely used for formatting the data. Following is the character set in ‘C’ programming:

1) Letters

Uppercase characters (A-Z)

Lowercase characters (a-z)

2) Numbers

All the digits from 0 to 9

3) White spaces

Blank space

New line

Carriage return

Horizontal tab

4) Special characters

Special characters in ‘C’ are shown in the given table,

Special Character Description
, (comma) { (opening curly bracket)
. (period) } (closing curly bracket)
; (semi-colon) [ (left bracket)
: (colon) ] (right bracket)
? (question mark) ( (opening left parenthesis)
‘ (apostrophe) ) (closing right parenthesis)
” (double quotation mark) & (ampersand)
! (exclamation mark) ^ (caret)
|(vertical bar) + (addition)
/ (forward slash) – (subtraction)
\ (backward slash) * (multiplication)
~ (tilde) / (division)
_ (underscore) > (greater than or closing angle bracket)
$ (dollar sign) < (less than or opening angle bracket)
% (percentage sign) # (hash sign)

In C programming, a token is the basic unit of a program. Tokens are the smallest building blocks of a C program, and they are classified into six categories:

  • Keywords: These are reserved words that have a specific meaning in C and cannot be used as names for variables, functions, or any other user-defined identifiers. Examples of keywords include int, char, and while.
  • Identifiers: These are names given to variables, functions, and other user-defined objects in a C program. Identifiers must start with a letter or an underscore, and can contain letters, digits, and underscores.
  • Constants: These are fixed values that cannot be changed during the execution of a program. Constants can be of various types, such as integer, floating-point, and character constants.
  • Strings: These are sequences of characters enclosed in double-quotes. Strings can be used to store text or a group of characters as a single entity. Special symbols: These are characters that have a special meaning in C, such as +, -, *, and /.
  • Operators: These are special symbols that perform specific operations on variables and values in a C program. Operators include arithmetic operators (e.g., +, -, *, /), relational operators (e.g., >, <, ==), and logical operators (e.g., &&, ||, !).
  • Special symbols: Special symbols are characters that are not letters or digits, but have a special meaning in C. Examples of special symbols include ;, (, ), {, and }.
  • Strings: Strings are sequences of characters that are enclosed in double quotes. Examples of strings in C include "Hello, World!" and "This is a string.".

In a C program, tokens are used to represent various elements, such as variables, constants, and keywords, and they are combined to form expressions and statements.

In addition to these types of tokens, C also has a number of punctuation symbols, such as parentheses, curly braces, and semicolons, which are used to structure the code and separate statements.

Related information

Sundar  Neupane

Sundar Neupane

I like working on projects with a team that cares about creating beautiful and usable interfaces.

If felt valuable to you, feel free to share it.


Report Response