Je souhaite écrire une fonction qui renvoie un pointeur sur un tableau bidimensionnel de pointeurs. J'ai ce tableau: Organism* worldTab[20][20];
et mon ami a conseillé d'écrire la fonction que je veux ainsi:Tableau bidimensionnel de pointeurs
Organism** getWorldTab() {
return worldTab[20];
}
est-il exact? Quand je veux faire (temp
est Organism*** temp;
):
*temp = world.getWorldTab();
Visual Studio lance une exception
Exception thrown: write access violation.
this->temp was 0xCCCCCCCC.
et je suis assez sûr getWorldTab()
fonctions est un problème.
définition worldTab: Organism* worldTab[20][20];
'worldTab [20]' est hors limites. –
Vous devez donner plus de contexte. Où est défini 'worldTab'? – tadman
S'il vous plaît lire http://stackoverflow.com/help/mcve et Modifier votre question – Sniper