cybersecurity · intermediate · ~15 min
Enforce an allowlist + length on input.
Implement int valid_username(const char *s) returning 1 if s is 1..32 chars and contains only letters, digits, and underscore, else 0.
int valid_username(const char *s) {
/* TODO */
return 0;
}
Solve this exercise in the browser editor — compile and run against the test harness, no setup required.