I'm getting the below error message:

GraphClient.c: In function ‘main’:

GraphClient.c:11: error: invalid application of ‘sizeof’ to incomplete type ‘struct Edge’

GraphClient.c:11: error: invalid initializer

Been playing around with graphs for a few weeks, and I've become notorious for this kind of error, but when I seek help my error is just corrected for me and I never understand why. Could someone please explain to me what is happening, and how to fix it, and why (or point me in the right direction)?

//GraphClient.c #include <stdio.h> #include <stdlib.h> #include "Graph.h" int main (int argc, char *argv[]) { int numVert = 0; printf ("Enter number of vertices: "); scanf ("%d", &numVert); Edge e[] = malloc(sizeof(struct Edge) * numVert); Graph new = newGraph(numVert); int cnt = 0; while (cnt < numVert) { scanf("%d-%d", &e[cnt].v,&e[cnt].w); insertE(new, e[cnt]); cnt++; } show(new); return 0; }

//Graph.h typedef int Vertex; typedef struct { Vertex v; Vertex w; } Edge; Edge mkEdge(Vertex a, Vertex B)/>; typedef struct graphRep *Graph; Graph newGraph (int nV); void insertE(Graph g, Edge e); void removeE(Graph g, Edge e); int edges(Edge e[], Graph g); Graph copy(Graph g); void destroy(Graph g); void show(Graph g);

I've excluded Graph.c, as I didn't think it was relevant.

Any help is appreciated

This post has been edited by **Allizoid**: 30 November 2010 - 08:40 AM