In C, a keyword has a defined syntactic role; an identifier is a name assigned by the programmer to something such as a variable, function, type alias, label or structure member. Confusing those categories causes compiler errors and occasionally hard-to-read code. The rules are simple enough to verify with a tiny program, provided you distinguish portable standard C from compiler extensions.
What a valid identifier looks like
A standard portable identifier uses letters, digits and underscores and cannot begin with a digit. Names are case-sensitive: count and Count are different. Some toolchains accept additional characters as extensions; do not rely on them in code that must compile under different C implementations.
#include <stdio.h>
int main(void) {
int count = 3;
int Count = 5;
int item_2 = count + Count;
printf("%d\n", item_2); /* 8 */
return 0;
}
Keywords cannot be reused as identifiers
Keywords such as int, if, return and while are reserved for grammar. Trying to declare int return = 3; is invalid. An identifier such as return_value is different and normally valid in local code.
/* Invalid: int return = 3; */
/* Valid: int return_value = 3; */
Avoid reserved identifier patterns
Some syntactically legal names are reserved to the language implementation or standard library in particular contexts. For portable application code, avoid identifiers beginning with an underscore at file scope and double-underscore-style names. Prefer straightforward descriptive local names rather than using identifiers that may collide with headers or compiler internals.
Use a type name without confusing it with a keyword
typedef is a keyword; size_t is a type name supplied by headers, not a C keyword. A developer can define an alias with a readable name, but that alias lives within the language’s scope rules. Avoid naming it after a standard library symbol.
typedef unsigned int item_count_t;
item_count_t n = 4;
This declaration is intended for a scope where it is legal, such as inside a function or a header. A real codebase should document why the alias improves readability rather than renaming every primitive.
Scope matters as much as spelling
A local variable can hide an identifier from an enclosing scope, making code surprising even if the compiler accepts it. Names for public APIs should be stable, understandable and unlikely to collide with other headers. Review shadowing warnings and avoid one-letter variables outside tiny loops.
Test under the C standard you actually support
C standards have introduced additional keywords across editions. Build with an explicit mode such as cc -std=c11 -Wall -Wextra for a C11 training exercise. An identifier accepted by an old compiler may become reserved by a later language version. The GNU C identifier reference describes common syntax, case and reserved-word distinctions.
Practical naming checklist
Start with a letter where possible; use underscores between words; name quantities by what they represent; avoid trailing numeric suffixes unless meaningful; do not reuse standard names; and make parameters explicit about units. Then compile a small example and correct the first diagnostic rather than guessing which keyword is at fault.