数据结构邻接矩阵表示不出来,深度遍历运行有错
#include "stdio.h"
#include "stdlib.h"
#define MAXVEX 20
#define INFINITY 10000000
typedef int Status;
typedef char VertexType;
typedef int EdgeType;
typedef struct
{
VertexType vexs[MAXVEX];
EdgeType arc[MAXVEX][MAXVEX];
int numNodes, numEdges;
}MGraph;
void CreateMGraph(MGraph *G)
{
int i,j,k,w;
printf("输入n和e:\n");
scanf("%d,%d",&G->numNodes,&G->numEdges);
for(i=0;i <G->numNodes;i++)
scanf(&G->vexs[i]);
for(i=0;i <G->numNodes;i++)
for(j=0;j <G->numNodes;j++)
G->arc[i][j]=INFINITY;
for(k=0;k<G->numEdges;k++)
{
printf("输入i,j,w:\n");
scanf("%d,%d,%d",&i,&j,&w);
G->arc[i][j]=w;
G->arc[j][i]= G->arc[i][j];
}
for(i=0;i<G->numNodes;i++);
{
for(j=0;j<G->numNodes;j++);
{
printf("%d\t", G->arc[i][j]);
}
printf("\n");
}
}
int main()
{ void DFS(MGraph *G);
int i;
MGraph *G;
CreateMGraph(MGraph *G);
printf("Print Graph DFS: ");
DFS(MGraph *G);
printf("\n");
return 0;
}
C:\Users\tutu\.c(48) : error C2143: syntax error : missing ')' before 'type'
C:\Users\tutu\.c(48) : error C2198: 'CreateMGraph' : too few actual parameters
C:\Users\tutu\.c(48) : error C2059: syntax error : ')'
C:\Users\tutu\.c(50) : error C2143: syntax error : missing ')' before 'type'
C:\Users\tutu\.c(50) : error C2198: 'DFS' : too few actual parameters
C:\Users\tutu\.c(50) : error C2059: syntax error : ')'
执行 cl.exe 时出错.
不会改
能够运行