标签:
char *p,*start,*end,*temp,c;
int count = 0,i =0 ;
p = (char *)malloc(21 * sizeof(char));
printf("请输入要反转的字符串:\n");
while ((c = getchar() )!= ‘\n‘) {
*(p + count) = c;
count++;
}
*(p+count)=‘\0‘;
start = p;
end = p+count-1; //结尾的尾0 \0
for(i = 0; i< count/2;i++,start++,end--)
{
temp = *start;
*start = *end;
*end = temp;
}
printf("%s",p);
标签:
原文地址:http://www.cnblogs.com/superrichie/p/4689642.html