typedef struct pointer definition

You cannot use pEDGE within the definition of the struct. You shoud do something like:

typedef struct edge {
    pEDGE_ITEM          *edge_item;  
    struct edge         *next;      //pointer to next edge
    struct edge         *prev;      //pointer to prev edge
} EDGE, *pEDGE;

You must also note that edge_item is a double pointer. You also mention that in your question. So if you use pEDGE_ITEM and you just want to have a normal pointer you should not write pEDGE_ITEM *edge_item but just pEDGE_ITEM edge_item.

For clarifying, all the following declarations are equivalent:

struct edgeitem *edge_item;
EDGE_ITEM *edge_item;
pEDGE_ITEM edge_item;

But

pEDGE_ITEM *edge_item;

is equivalent to

struct edgeitem **edge_item;
EDGE_ITEM **edge_item;

About *EDGE next that is wrong syntax. The correct syntax would be EDGE* next or pEDGE next. So once struct edge is defined you can just use any of these two, but while defining the struct, you must do as I show at the beginning of my answer.

Yes, the following two definitions are equivalent:

typedef struct edge_list {
    EDGE        *head;
} EDGE_LIST;

typedef struct edge_list {
    pEDGE        head;
} EDGE_LIST;

Leave a Comment