以下函数的功能是删除字符串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