pointers-memory · beginner · ~15 min
Write the bounds check that prevents dangling/out-of-range access.
Implement int index_in_bounds(int idx, int len) returning 1 if idx is a valid index into a len-element array (0 <= idx < len), else 0.
int index_in_bounds(int idx, int len) {
/* TODO */
return 0;
}
Solve this exercise in the browser editor — compile and run against the test harness, no setup required.