Swap first and last name in C
The function is maybe too ambitious in doing two things.

char *get_substr(char *str, char **endptr, const char *str_dim) {
    str = remove_leading_whitespace(str);
    char *substr = strtok(str, str_dim);
    *endptr = strtok(NULL, "\0");
    return substr;
}


I would keep the API simple and leave out endptr.