I am using a priority queue with a double as the priority. I am guessing this is cause so issues. I used these numbers first with no issues.
34.365681
34.481879
34.539832
36.715120
I then used these numbers and had a segmentation fault.
45.411042
40.481879
37.702110
38.951187
struct PRIORITYQUEUE
{
int x_pq;
int y_pq;
double heuristic_pq;
int priority;
int info;
struct PRIORITYQUEUE *next;
}*start, *q, *temp, *new;
typedef struct PRIORITYQUEUE *N;
void insert(int x, int y, double heuristic)
{
int item;
double itprio;
//new = ( N* ) malloc( sizeof( N ) );
new = malloc( sizeof( N ) );
itprio = heuristic;
new->x_pq = x;
new->y_pq = y;
new->heuristic_pq = itprio;
if ( start == NULL || itprio < start->heuristic_pq )
{
new->next = start;
start = new;
}
else
{
q = start;
while ( q->next != NULL && q->next->heuristic_pq <= itprio )
q = q->next;
new->next = q->next;
q->next = new;
}
}
void del()
{
if ( start == NULL )
{
printf( "\nQUEUE UNDERFLOW\n" );
}
else
{
new = start;
printf( "\nDELETED ITEM IS %d\n", new->info );
start = start->next;
free( start );
}
}
void display()
{
temp = start;
if ( start == NULL )
printf( "QUEUE IS EMPTY\n" );
else
{
printf( "QUEUE IS:\n" );
while ( temp != NULL )
{
printf( "\t x is %d y is %d[heuristic=%lf] \n", temp->x_pq, temp->y_pq, temp->heuristic_pq );
temp = temp->next;
}
}
}