Hi!

This is my first post on this board, so I would first like to say hello to everybody here!

I want to program a directed graph datastructure. OK, so here are my two types: edges and nodes:

Code:
struct node_struct
{
	unsigned int n_e;	// number of connected edges
	struct edge_struct **e;	// array of connected edges (array of pointers to edges)
};
typedef struct node_struct node;

struct edge_struct
{
	float c;		// capacity
	float f;		// flow
	node * u;	// start
	node * v;	// end
};
typedef struct edge_struct edge;
Further, I have these functions for memory allocation on the heap.
Code:
void alloc_node
(
 node ** u,
 unsigned int n
)
{
	*u = ((node)*) malloc(sizeof(node));
	if(*u == NULL)
	{
		printf("alloc_node: (1) Not enough storage available.\n");
		exit(1);
	}
	(*u)->n_e = n;
	(*u)->e = (edge**) malloc(n * sizeof(edge*));
	if ((*u)->e == NULL)
	{
		printf("alloc_node: (2) Not enough storage available.\n");
		exit(1);
	}
}


void alloc_edge
(
 edge** e
)
{
	*e = ((edge)*) malloc(sizeof(edge));
	if(*e == NULL)
	{
		printf("alloc_edge : Not enough memory available.\n");
		exit(1);
	}
	(*e)->c = 0.0f;
	(*e)->f = 0.0f;
	(*e)->u = 0;
	(*e)->v = 0;
}
Well, ok, this compiles fine (under MS VS 2003 Pro), with this main function:
Code:
int main()
{
	node * v1;
	//alloc_node(&v1,3);
	edge * a;
}
But if I uncomment the second line, then the compiler complains with

f:\src\main.c(18): error C2275: 'edge' : illegal use of this type as an expression

where line 18 eaxtly points to the line holding "edge * a;", so not the call to alloc_node.
But as I said, if I comment the call to the alloc_node, everything compiles fine.

I don't know where my error lies.

Thanks a lot in advance!

Best regards,
Oliver