Salut,
J'aimerai allouer un tableau de pointeur, mais j'ai un probleme.
void** tableauPointeur;
Que je mette:
tableauPointeur = (void*)malloc(256);
ou
tableauPointeur = (void**)malloc(256);
La compilation se déroule bien mais le programme plante au niveau de l'allocation... comment faire ?
What kind of technology is this?
Galmiza Le 08/07/2004 à 16:54Edité par Galmiza le 08/07/2004 à 16:55 J'en suis presque certain:
Ce code plante:
if(!(terrain = (void*)malloc(NUM_MAP_OBJET))) return 0;
return 0;
Mais quand je mets la premiere ligne en commentaire, ca fonctionne .
What kind of technology is this?
Le pb doit se situer avant, même s'il n'apparaît que là...
« The biggest civil liberty of all is not to be killed by a terrorist. » (Geoff Hoon, ministre des transports anglais)
Ok, je vais donc chercher le probleme ailleurs.
PS: L'edit, c'était juste pour mettre (void*)malloc(NUM_MAP_OBJET) au lieu de malloc(NUM_MAP_OBJET).
What kind of technology is this?
Bon, j'ai pas trouvé le problème mais je m'y suis pris autrement, a coups de memcpy.
C'est rapide memcpy ? (Ici, c'est pour l'initialisation donc il n'a pas besoin de vitesse, mais pour la suite on ne sais jamais)
What kind of technology is this?
Oui, c'est plutôt rapide.
« Quand le dernier arbre sera abattu, la dernière rivière empoisonnée, le dernier poisson capturé, alors vous découvrirez que l'argent ne se mange pas
. »