Programmer Coding

Tokens in C Language

What is Tokens?

Tokens in C are the most important concepts used when creating programs in C. We can define token as the smallest element in C. For example, we cannot create sentences without using words; Similarly, we cannot create a program in C without using C tokens. So, we can say that tokens in the C language are building blocks that serve in C mode or basic tools for creating programs.

Classification of tokens in C Language

  • Keywords:

Keywords are special words with prefixes in the C language.

Cannot be used as identifiers.

Examples: int, if, for, while, return

  • Identifiers:

Identifiers are names given to various programs (variables, functions, arrays, etc.).

Must start with a letter (uppercase or number) or underscore (_) and be followed by a letter, number, or underscore

  • Constants:

A constant is a value that does not change during program execution.

They can be many things: integer constants, floating point constants, character constants, string constants, etc.

Examples: 123, 3.14, ‘A’, “Hello”

  • String literals:

A string literal is a sequence of characters enclosed in double quotes (). Section

They represent a string of characters terminated by a null character (‘\0’).

Example: “programmercoding.com!”

  • Operators:

Operators are symbols that represent specific functions, such as arithmetic, logic, and relationships.

Examples: +, -, *, /, =, ==, &&, ||

  • Punctuators:

Punctuators are symbols that act as separators or delimiters in the C code.

Examples: ,, ;, (), {}, []

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top