좋아 액세스 위반 쓰기 위치를 구조체하기 :포인터
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.
이 디버거 사용하여 코드 줄에서 발생
edges.tail->next->a = newEdge->a;
이이 특정의 모든 코드입니다 부분 :이 내 에지 구조가
/* 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;
}
하고 내 가장자리 구조체 :
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;
그래서 '가장자리'라는 EDGES 배열에 EDGE를 추가하려고합니다.
제발 도와주세요!
'edges.tail'과'edges.tail-> next'가'NULL'이 아닌지 확인하지 않습니다. – wimh