linux-sysprog · beginner · ~15 min

Correct flag type for a handler

Know the one correct type for a handler flag.

Challenge

A flag shared with a handler must have the right type. Implement int flag_type_ok(const char *type) returning 1 only for "volatile sig_atomic_t".

Starter code

#include <string.h>

int flag_type_ok(const char *type) {
    /* TODO */
    return 0;
}

Solve this exercise in the browser editor — compile and run against the test harness, no setup required.