---
title: "Identifiers and rules"
subject: "Computer Programming"
chapter: 3
key: "semester_1/computer_programming:identifiers-rules"
source: https://www.bctengineer.com/q/semester_1/computer_programming/identifiers-rules
site: BCT Engineering
---

# Identifiers and rules

Computer Programming · Chapter 3: Introduction to ‘C’ programming

- Asked in: 2073 Chaitra, 2+3 marks
- Video: [C_09 Keywords and Identifiers | Programming in C](https://www.youtube.com/watch?v=Ywnv78X7TAg) — Jenny's Lectures CS IT
- Answer checked by Claude Opus 5.5 (high effort) on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_1/computer_programming/identifiers-rules
- Whole chapter: https://www.bctengineer.com/md/semester_1/computer_programming/chapter-3

## Question

What are identifiers? List the rules to define valid C identifiers.

## Short answer

Identifiers are user-defined names for variables, functions, etc. Rules: only letters, digits, underscore; first character not a digit; no spaces or special symbols; cannot be keywords; case-sensitive. Valid: _count, sum1; invalid: 2x, my-var, float.

## Answer

**Identifiers** are the names given by the programmer to variables, functions, arrays, structures and other user-defined items in a program, for example `total`, `sum1`, `calculate_area`.

#### Rules for valid identifiers
1. Only letters (A-Z, a-z), digits (0-9) and the underscore (`_`) are allowed.
2. The first character must be a letter or an underscore, not a digit (`2num` is invalid).
3. No spaces or special characters such as `- @ # $ %` are allowed (`my-var` is invalid).
4. A keyword cannot be used as an identifier (`int`, `float`, `while`).
5. C is case sensitive, so `Total`, `total` and `TOTAL` are three different identifiers.
6. The name should be meaningful. Only a limited number of leading characters are guaranteed to be significant (31 in C89; 63 for internal names in C99).

Examples: valid are `total_marks`, `_rate`, `num2`; invalid are `2num`, `my-var`, `float`.

## Check yourself

The answer's key points as multiple-choice questions, with the correct option and why.

1. What are identifiers in C?
   A. Names given by the programmer to variables, functions, arrays etc.
   B. Reserved words of the language
   C. Symbols that perform operations
   D. Fixed values in a program
   Answer: A. Identifiers are user-chosen names for items such as variables and functions. (Key point: Definition)

2. Which identifier is valid?
   A. 2num
   B. my-var
   C. float
   D. _rate
   Answer: D. An identifier may begin with a letter or underscore. 2num starts with a digit, my-var has a hyphen and float is a keyword. (Key point: Valid first character)

3. Which statement about total, Total and TOTAL is correct?
   A. They are the same identifier
   B. They are three different identifiers
   C. Only total is valid
   D. Only TOTAL is valid
   Answer: B. C is case sensitive, so they are different identifiers. (Key point: Case sensitivity)
