//实现字符串的复制
void strcpytwo(char b[],char a[])
{
int i = 0;
while (a[i] != '\0'){
b[i] = a[i];
i++;
}
}
//实现字符串长度的计算
int strlentwo(char a[])
{
int i = 0;
while (a[i] != '\0') {
i++;
}
return i;
}
//实现单词的反序输出
void antitone(char str[])
{
int i = 0;
int count = 0;
int b[20] = {};
while (str[i] != '\0') {
if (str[i] != ' ') {
count ++;
if (str[i + 1] == ' ' || str[i + 1] == '\0') {
b[i] = count;
count = 0;
}
}
i ++;
}
for (int i = 19; i >= 0; i --) {
if (b[i] != 0) {
for (int j = i - b[i] + 1 ;j < i + 1 ; j ++) {
printf("%c",str[j]);
}
printf(" ");
}
}
}
字符串的复制,长度计算,单词反序输出
最新推荐文章于 2022-05-21 01:09:31 发布