Auto commit

This commit is contained in:
2025-03-28 08:06:46 +08:00
parent 195f784173
commit d06b6fc13d
2 changed files with 27 additions and 9 deletions
+16 -3
View File
@@ -21,9 +21,22 @@ void fn(char* str){
p = str;
q = str;
/**********Program**********/
while(*p != '\0'){//p用来遍历所有元素
if(*p >= '0' && *p <= '9'){//当前位置指针的元素为数字
ch = *p;//备份当前的数字
q = p;//q存储当前这个数位置的地址
while(q != str){//将p地址前所有的字母整体后移一位
//到下一个元素地址为数组首地址或下一个元素为数字时停止
if(*(q-1) >='0' && *(q-1) <= '9'){
break;
}
*q = *(q-1);
q--;
}
*q = ch;
}
p++;
}
/********** End **********/
}
int main()