F
friend.05
I have follwoing structure definition.
struct _graph_vertex {
char *label;
int exectime;
};
struct _graph_edge {
int produced, consumed, delay;
};
struct _graph {
graph_vertex vertices[MAX_VTX];
graph_edge_pointer adjmtx[MAX_VTX][MAX_VTX];
};
Now while implenting, when I refer to above structure it is giving
error of core dump.
graph_pointer graph_construct(int *src, int *snk, int cnt)
{
graph_type g;
graph_pointer gptr;
gptr = &g;
int i,m1,m2;
/* for(i=0;i<MAX_VTX;i++)
{
printf("Enter execution time for Vertex %d\n",i);
scanf("%d",&g.vertices.exectime);
printf("Enter label for Vertex %d\n",i);
scanf("%s",&g.vertices.label);
}
*/
for(i=0;i<cnt;i++)
{
printf("Enter Produced for Edge %d\n",i);
scanf("%d", &g.adjmtx[2]->produced);
(It gives core dump error if I use i(variable) inside adjmtx[][], but
when I use constnt adjmtx[1][1] it does not give error.)
}
}
struct _graph_vertex {
char *label;
int exectime;
};
struct _graph_edge {
int produced, consumed, delay;
};
struct _graph {
graph_vertex vertices[MAX_VTX];
graph_edge_pointer adjmtx[MAX_VTX][MAX_VTX];
};
Now while implenting, when I refer to above structure it is giving
error of core dump.
graph_pointer graph_construct(int *src, int *snk, int cnt)
{
graph_type g;
graph_pointer gptr;
gptr = &g;
int i,m1,m2;
/* for(i=0;i<MAX_VTX;i++)
{
printf("Enter execution time for Vertex %d\n",i);
scanf("%d",&g.vertices.exectime);
printf("Enter label for Vertex %d\n",i);
scanf("%s",&g.vertices.label);
}
*/
for(i=0;i<cnt;i++)
{
printf("Enter Produced for Edge %d\n",i);
scanf("%d", &g.adjmtx[2]->produced);
(It gives core dump error if I use i(variable) inside adjmtx[][], but
when I use constnt adjmtx[1][1] it does not give error.)
}
}