怎样把一个字符串中的内容逆置
这个编程为啥不对呀#include<stdio.h>
int main()
{char *s="i love you";
fun(s);
printf("%s\n",s);
}
fun(char *s)
{
char *p=s;
char *q=s;
char temp;
while(*q) q++;
q--;
while(p<q)
{
temp=*p;
*p=*q;
*q=temp;
p++;
q--;
}
}
2016-06-25 23:39