您的位置:首页 > 其它

二级指针

2015-06-04 20:28 253 查看

<span style="font-size:18px;">#include <stdio.h>
void swap(int **r,int **s)//
{   int *t;
    t=*r;
    *r=*s;
    *s=t;
}

main()
{  int a=1,b=2,*p,*q;
   p=&a;
   q=&b;
   swap(&p,&q);
   printf("%d,%d\n",*p,*q);
}</span>


下左图为二级指针示意图,右图为一级指针示意图





#include <stdio.h>
void swap(int *r,int *s)
{   int *t;
    t=r;
    r=s;
    s=t;
}

main()
{  int a=1,b=2,*p,*q;
   p=&a;
   q=&b;
   swap(p,q);
   printf("%d,%d\n",*p,*q);
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: