C Keywords and Identifiers

Beginner
6 min read
Updated: Nov 2026
1 example

What Is Keywords and Identifiers?

Keywords are reserved words with fixed meaning (int, if, return). Identifiers are names you create for variables, functions, and types. They may use letters, digits, and _, cannot start with a digit, and cannot be keywords.

Remember
valid:    count   _tmp   total2   max_value
invalid:  2fast   my-var   int   float

Cheat Sheet

Keep these facts handy while you work with Keywords and Identifiers in C.

TopicDetail
Keywordsint, char, if, else, for, while, return, struct ...
Allowed charsLetters, digits, underscore
Start withLetter or underscore, never a digit
Stylesnake_case is common in C

C Examples

Compile each example with gcc file.c -std=c11 -Wall -o out. Next: Variables.

Example 1 — Valid identifiers in use

Descriptive names make code easier to read than single letters.

C
#include <stdio.h>

int main(void) {
    int student_count = 28;
    int _unused = 0;
    double average_score = 82.5;

    printf("%d students, average %.1f\n", student_count, average_score);
    return 0;
}

How It Works

  1. Underscores separate words in student_count.
  2. A leading underscore is legal, but avoid names like _Total that C reserves.
  3. Keywords such as int and double appear only as types.

Edge Cases & Pitfalls

Check these before relying on Keywords and Identifiers in real programs.

rsvd

Reserved names

Names starting with an underscore and a capital letter, or with two underscores, are reserved for the implementation.

case

Case confusion

Value and value are different identifiers. Pick one style and stick to it.

Key Takeaways

  • Keywords: cannot be reused as names.
  • Rules: letters, digits, _; no leading digit.
  • Names: choose descriptive identifiers.

One line: Keywords are reserved words with fixed meaning (int, if, return).

Frequently Asked Questions

C99 has 37 keywords and C11 adds more such as _Alignas and _Static_assert. The core ones are int, char, float, double, if, else, for, while, return, struct, and typedef.
Compilers must distinguish at least 31 characters for internal names, and modern compilers allow much more. Keep names reasonably short anyway.
Continue with "C Variables" next. Declare, initialize, and update named storage for values. The C Fundamentals hub lists every topic in order.

Next: Variables

Declare, initialize, and update named storage for values.

Continue →

CODETOFUN NEWS

Stay Ahead in Tech

Get the latest IT news, programming updates, and technology trends directly on your phone.

Your daily dose of tech, straight to your feed.

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

11 people found this page helpful