basics · intermediate · ~15 min
Validate input while scanning.
Implement int is_valid_format(const char *fmt) returning 1 if every % is followed by one of d s c x % (and not by end-of-string), else 0.
int is_valid_format(const char *fmt) {
/* TODO */
return 0;
}
Solve this exercise in the browser editor — compile and run against the test harness, no setup required.