C语言,编写一个函数:将给定字符串逆序
答案:2 悬赏:40 手机版
解决时间 2021-01-20 18:15
- 提问者网友:富士山上尢
- 2021-01-20 08:38
C语言,编写一个函数:将给定字符串逆序
最佳答案
- 五星知识达人网友:上分大魔王
- 2021-01-20 09:17
#include
#include
#include
void main()
{
char str,ch[]="this is a book";
int i,j,len;
len=strlen(ch);
for(i=0,j=len-1;i { str=ch[i];
ch[i]=ch[j];
ch[j]=str;
}
puts(ch);
return 0;
}
#include
#include
void main()
{
char str,ch[]="this is a book";
int i,j,len;
len=strlen(ch);
for(i=0,j=len-1;i
ch[i]=ch[j];
ch[j]=str;
}
puts(ch);
return 0;
}
全部回答
- 1楼网友:上分大魔王
- 2021-01-20 09:47
void reverse_str(char*str)
{
int len=strlen(str);
for(int i=0;i {
char t=str[i];
str[i]=str[len-1-i];
str[len-1-i]=t;
}
}
{
int len=strlen(str);
for(int i=0;i
char t=str[i];
str[i]=str[len-1-i];
str[len-1-i]=t;
}
}
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯