最近准备找工作了,看了个上机题,随便写出来看看:
int main()
{
char *str=(char *)malloc(100);
scanf("%s",str);
char *tail,*head;
head=str;
tail=str;
while(*tail!='\0')
{
tail++;
}
tail--;
while((tail-head)>0)
{
*head=*head^*tail;
*tail=*head^*tail;
*head=*head^*tail;
head++;
tail--;
}
printf("%s\n",str);
system("pause");
return 0;
}