basics · beginner · ~15 min
Reduce a value modulo 256 with correct negative handling.
Process exit codes are a byte (0-255). Implement int byte_exit(int n) returning n reduced into 0-255 (wrapping like the shell does), correct for negative n too.
int byte_exit(int n) {
/* TODO */
return 0;
}
Solve this exercise in the browser editor — compile and run against the test harness, no setup required.