string *与string[]
#include<stdio.h>#include<stdlib.h>
#define NUL '\0'
void reverse_string(char *string); // 将一个字符串转置
int main()
{
char *string="abcdefghijklm";
reverse_string(string);
puts(string);
return EXIT_SUCCESS;
}
void reverse_string(char *str)
{
char *last_char;
for(last_char=str;*last_char!=NUL;last_char++)
;
last_char--;
while(str<last_char)
{
char temp;
temp=*str;
*str++=*last_char; //这一行报错……
*last_char--=temp;
}
}