 |
C++Talk.NET C++ language newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Mirandole Guest
|
Posted: Sun Mar 19, 2006 3:06 pm Post subject: Tableau de chaînes à triple entrée !!! Help please |
|
|
Salut. Gros problème en C avec les tableaux à plusieurs entrée :
#include <math.h>
#include <stdio.h>
#define maxt 12
#define maxh 50
Void main(int narg, char ** argv)
{
char tabl[maxt][maxh][1][1024]; // tableaux de chaînes
1024 à triple entrée
unsigned int i, k, j;
for (i=0;i<9;i++){
k=i/3;
j=fmod(i,3);
sprintf(tabl[k][j][0],"bla%d",i);
sprintf(tabl[k][j][1],"bla%d",i); // la même chose
}
for (i=0 ; i<9 ; i++ ) {
k=i/3;
j=fmod(i,3);
fprintf(stderr,"%s\n%s\n\n" , tabl[k][j][0] , tabl[k][j][1] )
}
}
Bon, hé bien au lieu d'écrire comme espéré :
bla0
bla0
bla1
bla1
bla2
bla2
etc...
j'ai :
bla0
bla1
bla1
bla2
bla2
bla2
bla3
bla4
bref, j'y comprend rien... |
|
| Back to top |
|
 |
Fabien LE LEZ Guest
|
Posted: Sun Mar 19, 2006 4:06 pm Post subject: Re: Tableau de chaînes à triple entrée !!! Help please |
|
|
On Sun, 19 Mar 2006 15:50:59 +0100, Mirandole <gouailles (AT) hotmail (DOT) com>:
| Quote: | Gros problème en C
|
fr.comp.lang.c |
|
| Back to top |
|
 |
Sylvain Guest
|
Posted: Sun Mar 19, 2006 7:06 pm Post subject: Re: Tableau de chaînes à triple entré e !!! Help please |
|
|
Mirandole wrote on 19/03/2006 15:50:
| Quote: |
char tabl[maxt][maxh][1][1024]; // tableaux de chaînes
sprintf(tabl[k][j][0],"bla%d",i);
sprintf(tabl[k][j][1],"bla%d",i); // la même chose
|
donc, à tout le moins: tabl[maxt][maxh][*2*][1024].
Sylvain. |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|