LOGBOOK

HELP

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_case for variables and functions in C
  • UPPER_CASE for macros and constants
  • PascalCase for types (typedef structs)

From Quiz: REVE1 / C Programming | Updated: Jun 23, 2026