int truncate(char *s, int n)
{
    char new_str[n + 1];
    strncpy(new_str, s, n - 1);
    new_str[n] = '\0';
    if (strcmp(new_str, s) == 0)
    {
        int value = strlen(s) - n;
        s = &new_str;
        return value;
    }
    return 0;
}
Write a function named truncate() that takes a string s and a non-negative integer n. If s has more than n characters (not including the null terminator), the function should truncate s at n characters and return the number of characters that were removed. If s has n or fewer characters, s is unchanged and the function returns 0.