c语言写函数实现数组的反转要求用指针可运行?
代码示例:
#include<stdio.h>
void reverse_string(char *string)
{
char*last;
for (last = string; *last !bai= '\0'; last++);
last--;
while (string < last)
{
char temp;
temp = *string;
du *string++ = *last;
*last-- = temp;
}
}
void main()
{
char string[] = "abcdef";
printf("%s\n", string);
reverse_string(string);
printf("%s\n", string);
system("pause");
}