Soucis d'allocation dynamique en Borland C++
Fermé
djoly
Messages postés
2
Date d'inscription
mardi 21 janvier 2003
Statut
Membre
Dernière intervention
24 janvier 2003
-
24 janv. 2003 à 16:34
djoly Messages postés 2 Date d'inscription mardi 21 janvier 2003 Statut Membre Dernière intervention 24 janvier 2003 - 24 janv. 2003 à 17:57
djoly Messages postés 2 Date d'inscription mardi 21 janvier 2003 Statut Membre Dernière intervention 24 janvier 2003 - 24 janv. 2003 à 17:57
A voir également:
- Soucis d'allocation dynamique en Borland C++
- Tableau croisé dynamique - Guide
- Allocation dynamique d'une matrice en c - Forum C
- Impossible d'afficher le rapport de tableau croisé dynamique sur un rapport existant ✓ - Forum Excel
- Le nom du champ de tableau croisé dynamique n'est pas valide ✓ - Forum Excel
- Tableau croisé dynamique différence entre deux colonnes ✓ - Forum Excel
1 réponse
/*
*
* Voici une petite fonction qui pourais t'être pratique.
*
*/
#include <stdlib.h>
short alloc_matrix(int **ptr_table, int height, int weight);
int main(){
int table **table;
alloc_matrix(table,4,5);
*(*(table+2)+2)=3; // equal to : table[2][2]=3;
return 0;
}
short alloc_matrix(int **ptr_table, int height, int weight){
int **my_table, count1, count2;
my_table=malloc(sizeod(int)*height);
for(count1=0;count1<height;count1++){
*(my_table+count1)=(int *)malloc(sizeof(int)*weight);
}
for(count1=0;count1<height;count1++){
for(count2=0;count2<weight;count2++){
*(*(my_table+count1)+count2)=0x0;
}
}
ptr_table=my_table;
return 0;
}
// Bonne chance
// josch83
*
* Voici une petite fonction qui pourais t'être pratique.
*
*/
#include <stdlib.h>
short alloc_matrix(int **ptr_table, int height, int weight);
int main(){
int table **table;
alloc_matrix(table,4,5);
*(*(table+2)+2)=3; // equal to : table[2][2]=3;
return 0;
}
short alloc_matrix(int **ptr_table, int height, int weight){
int **my_table, count1, count2;
my_table=malloc(sizeod(int)*height);
for(count1=0;count1<height;count1++){
*(my_table+count1)=(int *)malloc(sizeof(int)*weight);
}
for(count1=0;count1<height;count1++){
for(count2=0;count2<weight;count2++){
*(*(my_table+count1)+count2)=0x0;
}
}
ptr_table=my_table;
return 0;
}
// Bonne chance
// josch83
24 janv. 2003 à 17:57
Cordialement