结构体求解
#include "stdio.h"
struct har
{int x,y;
struct har *p;}h[2];
main()
{ h[0].x=1;h[0].y=2;
h[1].x=3;h[1].y=4;
h[0].p=h[1].p;
h[1].p=h;
printf("%d%d",(h[0].p)->x,(h[1].p)->y);}
这个程序编译成功,但不能运行.
[解决办法]
h[0].p=h[1].p;
这里h[1].p还没赋值,当然不能运行了。
估计你是想h[0].p = &h[1]吧
[解决办法]
你是想建立链表吧。就是 h[0].p=h[1].p这地方的问题。