linux-sysprog · intermediate · ~15 min
Tokenise a command line.
A shell splits a command line on whitespace. Implement int count_args(const char *line) returning the number of whitespace-separated tokens.
int count_args(const char *line) {
/* TODO */
return 0;
}
Solve this exercise in the browser editor — compile and run against the test harness, no setup required.