#include<stdio.h>
int source =1;
int* cope_adress(int *a)
{
a=&source;
}
int main()
{
int b=2;
int *purposes;
printf("source address is %p\n",&source);
purposes=&b;
cope_adress(purposes);
printf("cope_adress is %p\n",purposes);

}
*************************************
*************************************
book@xxx:~/work$ g++ myname.c
book@xxx:~/work$ ./a.out
source address is 0x601040
cope_adress is 0x7ffdad9a7b7c
#include<stdio.h>
int source =1;
int* cope_adress(int **a)
{
*a=&source;
}
int main()
{
int b=2;
int **purposes;
printf("source address is %p\n",&source);
int *myb=&b;
purposes=&myb;
cope_adress(purposes);
printf("cope_adress is %p\n",*purposes);

}
*************************************
*************************************
book@xxx:~/work$ gcc 1.c
book@xxx:~/work$ ./a.out
source address is 0x601040
cope_adress is 0x601040

看上去,只有 函数形参 是函数体内的使用的变量的地址才可以赋值成功。