急急急!!!C语言编程题:编写函数strcat(char *t,char *s)将字符串s中的全部数字字符连接到t的尾部。

另外还有一道题(请大神顺便做一下吧):用clean(char *t)实现将t中全部英文字母删除,要求在主函数中定义数组存储字符串信息。调用函数实现链接后输出结果。

#include <ctype.h>
void strcat(char * t, char * s)
{
    while (*t)
        t++;
    while (*s) {
        if (isalnum(*s)) {
            *t = *s;
            t++;
        }
        s++;
    }
    *t = 0;
}
void clean(char * s)
{
    char * p = s;
    while (*s) {
        if (!isalpha(*s)) {
            *p = *s;
            p++;
        }
        s++
    }
    *p = 0;
}

追问

组建的时候显示没有错误,但运行的时候显示有错误,无法运行。

追答

给strcat改个名字嘛。。。

温馨提示:答案为网友推荐,仅供参考
相似回答