以下函数的功能是删除字符串s中的所有大写英文字母

以下函数的功能是删除字符串s中的所有大写英文字母

#include <stdio.h>
// 以下函数的功能是删除字符串s中的所有大写英文字母
void dele(char *s)
{
    
    
    int n = 0, i;
    for (i = 0; s[i]; i++)
        if (!(s[i] >= 'A' && s[i] <= 'Z')) // 1 
            s[n++] = s[i];
    s[n] = '\0'; // 2 
}

int main()
{
    
    
    char str[] = "ABcDabcd";
    dele(str);
    printf("%s\n", str);
    return 0;
}

result:

cabcd

猜你喜欢

转载自blog.csdn.net/qq_44880154/article/details/110496170