basics · beginner · ~15 min
Find the end of a string.
Implement char last_char(const char *s) returning the last character before the NUL, or '\0' if empty.
#include <string.h>
char last_char(const char *s) {
/* TODO */
return 0;
}
Solve this exercise in the browser editor — compile and run against the test harness, no setup required.