SIGBUS error... could use help... :S
Posted: 31 Mar 2007, 08:24
Hey, I keep getting SIGBUS errors when trying to access this variable outside it's initalising function, and have been for a while... Not sure why...
Can anyone help?
P.S. Bear in mind I'm fairly new to C++...
Can anyone help?
Code: Select all
class square {
public:
int unit;
int terrain;
bool path;
};
square** squares;
void makesquares() {
square** squares = new square*[x];
for (int i = 0; i < y; i++) {
*(squares + i) = new square[y];
}
for (int i = 0; i < x; i++ ) {
for (int j = 0; j < y; j++ ) {
squares[i][j].unit = -1;
squares[i][j].terrain = 0;
squares[i][j].path = false;
}
}
}