Quiz Entry - updated: 2026.06.23
What are the rules for C identifiers (variable/function names)?
A name must start with a letter or underscore, then contain only letters, digits, or underscores — and it's case-sensitive.
Regex: [a-zA-Z_][a-zA-Z0-9_]*
Valid identifiers:
int count;
int _private;
int player1;
int camelCase;
int snake_case;
Invalid identifiers:
// Can't start with digit
int 1stPlace;
// Hyphens not allowed
int my-var;
// Spaces not allowed
int my var;
// Reserved keyword
int class;
Case sensitivity:
int HSLU;
int Hslu;
int hsLU;
// All four are DIFFERENT variables!
int hslu;
Convention tip:
snake_casefor variables and functions in CUPPER_CASEfor macros and constantsPascalCasefor types (typedef structs)