Okay so I have this issue:
Unhandled exception at 0x00261A46 in CompGeometry.exe: 0xC0000005: Access violation writing location 0xCDCDCDED.
First-chance exception at 0x00261A46 in CompGeometry.exe: 0xC0000005: Access violation writing location 0xCDCDCDED.
This occurs at this line of code using the debugger:
edges.tail->next->a = newEdge->a;
This is all the code for this specific part:
/* non-empty list -- add it */
if (edges.head != NULL)
{
printf("1 %d, %d\n", newEdge->a.x, newEdge->a.y);
printf("2 %d, %d\n", newEdge->b.x, newEdge->b.y);
//edges.tail->next = new hull::EDGE;
edges.tail->next->a = newEdge->a;
edges.tail->next->b = newEdge->b;
newEdge->next = NULL;
edges.tail->a.x = newEdge->a.x;
edges.tail->a.y = newEdge->a.y;
edges.tail->b.x = newEdge->b.x;
edges.tail->b.y = newEdge->b.y;
}
/* empty list -- 1st item */
else
{
edges.head = newEdge;
edges.tail = newEdge;
newEdge->next = NULL;
}
This is my edge structure and my edges struct:
typedef struct line {
VERTEX a;
VERTEX b;
struct line *next;
} EDGE;
struct edges {
int size;
EDGE* head;
EDGE* tail;
};
//all edges of the hull
struct edges edges;
So, I am trying to add an EDGE to an array of EDGES named 'edges'.
Please Help!