cybersecurity · intermediate · ~15 min

Parse a hex byte

Validate fixed-width hex input.

Challenge

Implement int parse_hex_byte(const char *s, int *out) parsing exactly two hex digits into a value 0..255, returning 1 on success or 0 otherwise.

Starter code

int parse_hex_byte(const char *s, int *out) {
    /* TODO */
    return 0;
}

Solve this exercise in the browser editor — compile and run against the test harness, no setup required.