
int truncate(char *s, int n){
    if (n < 0){
        return 1;
    }
    else{
        if (strlen(s) - 1 <= n){
            return 0;
        }    
        else{
            int i;
            for (i = 0; i <= n - 1; i++){
                s[i] = s[i]; 
            }
            s[i] = '/0';
            return strlen(s) - n - 1;
        }
    }
}
 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. For example,
    if s is the string "function" and n is 3, then truncate() changes s to
    the string "fun" and returns 5.