Tableaux à plus de une dimension
Définition :
Il s'agit d'un tableau de tableaux
Syntaxe : Déclaration
1
type nom_tableau[dim1][dim2]...[dimn]
Exemple :
1
char buffer[20][80];
2
int mat[6][10];
3
char livres[100][60][80];
4
float pilaf[3][2]={{1.0,3.5},{2.34,5.6},{5.3,6.7}};
Accès aux éléments :
1
nom_tableau[ind1][ind2]...[indn]
Exemple :
1
livre[30][15][20] = 'c';
2
mat[5][6] =13;
3
printf("mat[5][6] = %d\n", mat[5][6]);