linux-sysprog · beginner · ~15 min
Walk a NULL-terminated pointer array.
exec takes a NULL-terminated argv array. Implement int argv_len(const char *const *argv) returning the number of arguments before the terminating NULL.
#include <stddef.h>
int argv_len(const char *const *argv) {
/* TODO */
return 0;
}
Solve this exercise in the browser editor — compile and run against the test harness, no setup required.