Hi all!
Banging my head for 1 hour, can't find the answer:
int *get_possible_moves(int **board, int *w, int *h, int *x, int *y) {
int movespossible=0;
int moveslist[2][8];
//4
if(x + 1 <= w-1 && y + 2 <= h - 1) {
if(board[*(int *)y + 2][*(int *)x + 1] == 0) {
moveslist[movespossible][0] = *(int *)x + 1;
breakpoint-> moveslist[movespossible][1] = *(int *)y + 2;
movespossible++;
}
}
At a line marked breakpoint-> my **board gets dereferenced. Any clues why it is so? There are no concurrent threads that are using this place in memory. Also, I am not using **board at all at this line.
//3
if(x + 2 <= w - 1 && y + 1 <= h - 1) {
if(board[*(int *)y + 1][*(int *)x + 2] == 0) {
moveslist[movespossible][0] = *(int *)x + 2;
moveslist[movespossible][1] = *(int *)y + 1;
movespossible++;
}
}
This code works flawlessly.
Thanks in advance!