有请高手帮小弟我看下那里出错了?

有请高手帮我看下那里出错了??
int   *p=   NULL;
int   **test=   NULL;
            *test   =p;
cout < <*test < <endl;

------解决方案--------------------
不要被 太多的**所迷惑
test是一个指针,指向(int*)类型

int **test= NULL; // 这里 test=NULL,其实没有给test指针分配空间
*test =p; // 这里访问的实际上是 NULL 指针指向的内容,所以会出错
cout < <*test < <endl; // 执行不到这里
------解决方案--------------------
#include <iostream.h>
#include <stdio.h>
int main()
{
int *p= NULL;//定义指针P
int **test= NULL;//定义指针test,并且赋值NULL,此处赋值可以任意,只要合法就可以.
*test =p;//此处为作赋值,对二级指针的一级指针赋值空,这是执行时内存出错的原因
cout < <*test < <endl;
return 0;
}
以上程序在编译的时候,并没有出错.-Configuration: a - Win32 Debug--------------------
Linking...

a.exe - 0 error(s), 0 warning(s)
执行的时候可能会出问题.
------解决方案--------------------
int *p= NULL; //指针所指向的类型是int
int **test= NULL;//指针所指向的类型是int *
*test =p; //因为两个指针类型不一样,所以error。。。

-------------------------------------
*test 与 p的类型是一致的。至于不对的原因,前面已经有人替你分析了。是因为对一个空指针解引用造成非法访问。