• 08-24-2010
erasm
I can't find anything wrong with my code. When i debug, this occurs.

Unhandled exception at 0x00fb74b1 in pacman.exe: 0xC0000005: Access violation reading location 0xfdfdfdfd.

Code:

```printf("Lowest F = %d, x:%d, y:%d", lowestf, openX[lowestf], openY[lowestf]);         ScanAdjacentNodes(openX[lowestf], openX[lowestf]);```
The printf works fine, some integers are printed.

If i parse values like this there is no problem.
Code:

`ScanAdjacentNodes(5, 5);`
Code:

```int openX[550]; int openY[550];```
Code:

```void ScanAdjacentNodes(int x, int y) {         if(FREE(x+1, y)) {                 f[index]=hscore(x+1, y);                 openX[index]=x+1;                 openY[index]=y;                 index++;         } else {                 closedX[j] = x+1;                 closedY[j] = y;                 j++;         }         if(FREE(x-1, y)) {                 f[index]=hscore(x-1, y);                 openX[index]=x-1;                 openY[index]=y;                 index++;         } else {                 closedX[j] = x-1;                 closedY[j] = y;                 j++;         }         if(FREE(x, y+1)) {                 f[index]=hscore(x, y+1);                 openX[index]=x;                 openY[index]=y+1;                 index++;         } else {                 closedX[j] = x;                 closedY[j] = y+1;                 j++;         }         if(FREE(x, y-1)) {                 f[index]=hscore(x, y-1);                 openX[index]=x;                 openY[index]=y-1;                 index++;         } else {                 closedX[j] = x;                 closedY[j] = y-1;                 j++;         } }```
• 08-24-2010
zacs7
What's the signature for ScanAdjacentNodes()? And the definition of the variables? You haven't given enough information.
• 08-24-2010
Elysia
IIRC, 0xfdfdfdfd means that you're trying to use a freed variable.