首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C语言 >

想学习双重指针,程序执行时出错,哎!1解决方案

2012-04-07 
想学习双重指针,程序执行时出错,哎!!!1#include stdio.hstatic int *g NULLvoid find(int ** pa){*pa

想学习双重指针,程序执行时出错,哎!!!1
#include <stdio.h>
static int *g = NULL;
void find(int ** pa)

{
*pa = g;
}

 void main()

{

int ** test = NULL;
int a = 99;
g =&a;
find(test);
getchar();

}

错误信息:otto01.exe 中的 0x004113e7 处未处理的异常: 0xC0000005: 写入位置 0x00000000 时发生访问冲突,应该是*pa = g;这行错了。


[解决办法]
*pa = g; 这句有问题!
因为int ** test = NULL; 但是未指定 *test 所以 *pa 不知道指向何处了!

热点排行