check if pid exists c

#include <sys/types.h>
#include <signal.h>

int processExists(pid_t pid) {
    if (kill(pid, 0) == 0) {
        return 1;
    } else {
        return 0;
    }
}