Curriculum
Course: C basic
Login

Curriculum

C basic

C Introduction

0/1

C Get Started

0/1

C Comments

0/1

C Constants

0/1

C Operators

0/1

C Break and Continue

0/1

C User Input

0/1

C Memory Address

0/1

C Structures

0/1
Text lesson

Variable Names

C Variable Names

Every C variable must be distinguished by a unique name.

These distinctive labels are referred to as identifiers.

Identifiers can range from brief names (such as x and y) to more descriptive ones (like age, sum, and totalVolume).

Note: It’s advisable to employ descriptive names to ensure the clarity and maintainability of your code.

Example

// Good variable name
int minutesPerHour = 60;

// OK, but not so easy to understand what m actually is
int m = 60;

The general guidelines for naming variables are:

  • Names may consist of letters, digits, and underscores.
  • Names must commence with a letter or an underscore (_).
  • Names are case-sensitive, meaning “myVar” and “myvar” represent distinct variables.
  • Names cannot include whitespaces or special characters like !, #, %, etc.
  • Reserved words ( e.g., int ) cannot serve as names.