onder->buren[0] = boven;
onder->buren[1] = boven -> buren[2];
onder->buren[7] = boven -> buren[6];
boven->buren[4] = onder;
boven->buren[3] = onder -> buren[2];
boven->buren[5] = onder -> buren[6];
onder = onder -> buren[2];
boven = boven -> buren [2];
for (int i = 0; i < n; i++){
bordvakje* volgende;
volgende = new bordvakje;
volgende->buren[2] = ingang;
ingang->buren[6] = volgende;
ingang = volgende;
}
return result;
}
void othellobord::bouwbord (int n) {
bordvakje* boven;
bordvakje* onder;
for (int i = 0; i < n; i++){
onder = maakrij ( 8 );
rits(boven,onder);
boven = onder;
}
void othellobord::bouwbord (int n)
{ bordvakje* boven;
bordvakje* onder;
for (int i = 0; i < n; i++)
{ onder = maakrij ( 8 );
rits (boven,onder);
boven = onder;
}
}
line 7: boven is an uninitialized pointer (garbage) when it is passed to rits on the first iteration.
PLEASE USE CODE TAGS (the <> formatting button) when posting code.
It makes it easier to read your code and also easier to respond to your post. http://www.cplusplus.com/articles/jEywvCM9/
Hint: You can edit your post, highlight your code and press the <> formatting button.
What do u mean exactly with a uninitialized pointer(garbage)?
How should i fix this?Which values in rits(boven,onder)?
I need to make an 8 * 8 othelloboard with pointers and i cannot print the board