file-handling · intermediate · ~15 min
Inspect the file-type bits of st_mode.
Implement int is_regular_file(const char *path) returning 1 if path is a regular file (use stat + S_ISREG), else 0 (including when stat fails).
#include <sys/stat.h>
int is_regular_file(const char *path) {
/* TODO */
return 0;
}
Solve this exercise in the browser editor — compile and run against the test harness, no setup required.