C Programming Tutorial 0/65 lessons ~6 min read Lesson 6
Identifiers
Identifiers are names for variables, functions, and types.
Course progress0%
Focus
9 guided sections
Practice signal
Examples included
Career prep
Foundation builder
Introduction
Identifiers are names for variables, functions, and types. Rules: letters, digits, underscore; must not start with a digit; case-sensitive; cannot use keywords.
Understanding the topic
Valid names count, _temp, studentId2
Invalid names 2count, my-var, int (keyword)
Convention Use snake_case or camelCase consistently.
- Valid names — count, _temp, studentId2.
- Invalid names — 2count, my-var, int (keyword).
- Convention — Use snake_case or camelCase consistently.
Step-by-step explanation
- Valid names — count, _temp, studentId2.
- Invalid names — 2count, my-var, int (keyword).
- Convention — Use snake_case or camelCase consistently.
Syntax reference
Syntax reference:
c
letter (letter | digit | _)*
Execution workflow
1Identifiers — step by step
1 / 3Valid names
count, _temp, studentId2.
Best practices
- Enable warnings: gcc -Wall -Wextra -std=c11 source.c -o app
- Give every variable a defined value before it is read.
- Stay inside array bounds — C will not stop you from over-running a buffer.
Common mistakes
- Reading uninitialized storage — behavior is undefined.
- Dismissing compiler warnings instead of fixing root causes.
- Ignoring NULL returns from malloc, fopen, and similar APIs.
Hands-on exercise
Practice problems:
- List valid and invalid identifiers
- Rename ambiguous names
Summary
Identifiers in C — Naming rules for variables, functions, and types in C.
Ready to mark this lesson complete?Track your journey across the entire course.