pointers-memory · beginner · ~15 min
Measure a string with two pointer positions.
Implement int str_len_ptr(const char *s) returning the length using pointer subtraction (advance to the NUL, then subtract).
int str_len_ptr(const char *s) {
/* TODO */
return 0;
}
Solve this exercise in the browser editor — compile and run against the test harness, no setup required.