cybersecurity · intermediate · ~15 min
Parse defensively with a value ceiling.
Implement int parse_uint_max(const char *s, int max, int *out) parsing a non-negative decimal integer, returning 1 if it's all digits and <= max, else 0.
int parse_uint_max(const char *s, int max, int *out) {
/* TODO */
return 0;
}
Solve this exercise in the browser editor — compile and run against the test harness, no setup required.