请教Stack around the variable 'v1' was corrupted,我这个怎么解决?是有关邻接多重表的建立的。
#include <iostream>using namespace std;//----------------无向图的邻接多重表存储结构的定义//------------书P116const int NUM=100;const int Num=2;//每个顶点所表示的数据typedef char VertexType[Num]; typedef struct EBox{ int mark; int ivex,jvex; struct EBox *ilink,*jlink; }EBox;typedef struct VexBox{ VertexType data; EBox *firstedge;}VexBox;typedef struct { VexBox adjmulist[NUM]; int vexnum,edgenum;//顶点数,边数}AMLGraph;int LocateVex(AMLGraph G,VertexType u){ int i; for(i=0;i<G.vexnum;i++) {if(strcmp(u,G.adjmulist[i].data)==0) return i;} return -1;}int CreateGraph(AMLGraph &G){ cout<<"请输入图的顶点数、弧数:"; cin>>G.vexnum; //输入图当前的顶点数 cin>>G.edgenum; //输入图当前的边数 cout<<"请输入每个顶点的值:"<<endl; for(int i=0;i<G.vexnum;i++) { cin>>G.adjmulist[i].data; //输入顶点值 G.adjmulist[i].firstedge=NULL;//初始化指针为空 } VertexType v1,v2; EBox *p; int i,j; //每条弧所关联的两个结点 for(int k=0;k<G.edgenum;k++) { cout<<"请输入第"<<k+1<<"弧的始点和终点:"; cin>>v1;cin>>v2; i=LocateVex(G,v1);j=LocateVex(G,v2);//确定v1和v2在图G中的位置 cout<<"i="<<i<<" "<<"j="<<j<<endl; cout<<"G.adjmulist[i].firstedge"<<G.adjmulist[i].firstedge<<" "<<"G.adjmulist[j].firstedge"<<G.adjmulist[j].firstedge; p=(EBox *)malloc(sizeof(EBox)); //p = new (EBox); cout<<"p="<<p<<endl; //对结点域进行赋值 (*p).mark=0; (*p).ivex=i; (*p).jvex=j; (*p).ilink=G.adjmulist[i].firstedge; (*p).jlink=G.adjmulist[j].firstedge; G.adjmulist[i].firstedge=G.adjmulist[j].firstedge=p; } return 1;}int main(){ AMLGraph g; CreateGraph(g); return 0;}