问个关于指针的问题~
#include <stdlib.h>#include <stdio.h>
void swap(int **p1, int **p2)
{
int *temp;
temp = *p1;
*p1 = *p2;
*p2 = temp;
}
int main()
{
int a, b;
int *pointer_1, *pointer_2;
scanf("%d%d", &a,&b);
pointer_1 = &a;
pointer_2 = &b;
if (a < b)
swap(&pointer_1,&pointer_2);
printf("%d %d\n",*pointer_1,*pointer_2);
printf("%d %d\n",a,b);
system("PAUSE");
return 0;
}
=======================================================================int *temp;
temp = *p1;
*p1 = *p2;
*p2 = temp;
给上面的东西加个注释。搞不懂啊*p1是引用的什么?
temp = *p1; 一级指针为什么指向了二级指针?
int *temp; int temp;
temp = *p1; temp=**p1;
*p1 = *p2; 和 **p1=**p2;
*p2 = temp; **p2=temp;
有什么区别???
=======================================================================高手帮帮我啊~有些乱啊!!!!!!!!谢谢各位!
=======================================================================