Wednesday, 15 May 2013

graph - Initializing a structure in C gives "declaration of anonymous struct must be a definition" error -


I have a structure known as an edge in my C code

  Struct edge {int weight; Node * node 1; Node * node 2; };  

Where node is another structure which is also defined in my code. When I try to declare the edge in my code then

  struct I get two errors: 1) The declaration of the unknown structure should be a definition 2) Type: ab * (struct edge *) malloc (sizeof (struct (edge));  

The name requires a specifier or qualifier.

Am I doing wrong? My node structure has been defined for more reference

  struct node {char data; Structure node * parents; };  

  size (structure (edge))  

sizeof (struct edge)

to add () to a composition tag Not allowed.


No comments:

Post a Comment