如何用两个指针指向待交换的两个字符处,通过间接访问的方式做交换?不太懂指针
第1个回答 2018-12-17
#include <stdio.h>
#include <string.h>
int main()
{
char test[] = "QQ:2-3-6-4-6-2-2-4-2-3";
char *p = test, *q = test + strlen(test) - 1;
printf("翻转前:%s\n", test);
while(p < q) {
char c = *p;
*p++ = *q;
*q-- = c;
}
printf("翻转后:%s\n", test);
return 0;
}本回答被网友采纳
#include <string.h>
int main()
{
char test[] = "QQ:2-3-6-4-6-2-2-4-2-3";
char *p = test, *q = test + strlen(test) - 1;
printf("翻转前:%s\n", test);
while(p < q) {
char c = *p;
*p++ = *q;
*q-- = c;
}
printf("翻转后:%s\n", test);
return 0;
}本回答被网友采纳
第2个回答 2018-12-17
你把函数中所有的a[i][j]换成*(*(a+i)+j)这种形式,就可以了。
第3个回答 2018-12-17
#include // 逆置数组元素void inverse(int *p,int size){ for (int i = 0; i追问
?大佬你没上传完