C Programming • C Basics, Operators, Loops
C Programming / C tokens

C tokens

Notes 2 C Basics, Operators, Loops

A token is the smallest meaningful unit of a C program recognized by the compiler. A C program is made up of different types of tokens such as keywords, identifiers, constants, strings, operators and special symbols.

Notes

C Tokens

A token is the smallest meaningful unit of a C program recognized by the compiler. A C program is made up of different types of tokens such as keywords, identifiers, constants, strings, operators and special symbols.

💡 In Simple Words

Tokens are the basic building blocks of a C program. Just as words and punctuation form a sentence, tokens form a C program.

Example

int sum = a + b;

In the above statement:

Token Type
int Keyword
sum Identifier
= Operator
a Identifier
+ Operator
b Identifier
; Special Symbol / Punctuator

Types of C Tokens

Type Meaning Examples
Keywords Reserved words with a fixed meaning in C. int, if, return
Identifiers Names given to variables, functions and other program elements. sum, main, count
Constants Fixed values that do not change during program execution. 10, 3.14, 'A'
Strings Sequence of characters written inside double quotes. "Hello", "BCA"
Operators Symbols used to perform operations. +, -, =
Special Symbols Symbols used to structure and separate parts of a program. ;, {}, (), []

1. Keywords

Keywords are reserved words of the C language that have predefined meanings. They cannot normally be used as names of variables or functions.

💡 Examples

int, if, else, while, return, for

2. Identifiers

Identifiers are names used to identify program elements such as variables, functions and arrays.

Rules for Identifiers

  • An identifier can contain letters, digits and underscore.
  • It should not begin with a digit.
  • Keywords cannot be used as identifiers.
  • C identifiers are case-sensitive.
Valid Invalid
total 2total
student_name student-name
marks1 int

3. Constants

Constants are fixed values used in a program. Their value remains unchanged while the program is running.

💡 Examples

Integer: 25
Decimal: 3.14
Character: 'A'

4. Strings

A string is a sequence of characters enclosed in double quotation marks.

💡 Examples

"Hello"
"BCA Study Portal"

5. Operators

Operators are symbols used to perform operations on values or variables.

Operator Example Purpose
+ a + b Addition
- a - b Subtraction
* a * b Multiplication
/ a / b Division
= a = 10 Assignment

6. Special Symbols

Special symbols help define the structure and separation of statements and blocks in a C program.

Symbol Common Use
; Ends a statement.
() Used with functions and expressions.
{} Defines a block of statements.
[] Used for arrays.
, Separates items such as variables or function arguments.

Quick Revision

Token Type Remember
Keyword Reserved word
Identifier Name given by programmer
Constant Fixed value
String Characters inside double quotes
Operator Performs an operation
Special Symbol Helps structure the program

Important Exam Questions

Short Answer Questions

  1. What are tokens in C?
  2. Write the different types of C tokens.
  3. What are keywords?
  4. What are identifiers?
  5. What are constants?
  6. What are operators?
  7. What are special symbols in C?
  8. Write any four rules for naming identifiers.

Long Answer Questions

  1. Define C tokens and explain their different types with examples.
  2. Explain keywords, identifiers, constants, strings, operators and special symbols with suitable examples.
  3. Explain the rules for naming identifiers in C.
🎥 Recommended Learning

Watch a beginner-friendly explanation of C tokens and their different types.

▶ Watch: C Tokens — Keywords, Identifiers, Constants & Operators

📝 Handwritten Notes

A short handwritten-style revision sheet for C Tokens will be provided here.

🧠 Mind Map

Use the mind map for quick revision of the six types of C tokens.