如何通过二级指针间接赋值,首先举个例子:
# define _CRT_SECURE_NO_WARNINGS
# include <stdio.h>
# include <stdlib.h>
# include <string.h>
void fun2(int * p)
{
p = 0xaabb;
printf("fun2:p = %p\n", p);
}
void fun3(int ** p)
{
*p = 0xeeff;
}
int main(void)
{
//一个变量,应该定义一个怎样类型的指针保存它的地址
//在原来类型的基础上加一个 *
//int a = 10;
//int * p = &a;
//int **q = &p;
//int ************ t = NULL;
//int ************* t2 = &t;
int * p = 0x1122;
printf("p1 = %p\n", p);
fun2(p);//值传递
printf("p2 = %d\n", p);
fun3(&p);
printf("p3 = %p\n", p);
printf("\n");
system("pause");
return 0;
}