#include <stdio.h> #define maxM 4 typedef float Matrice[maxM][maxM]; void Affichermat(Matrice val) { int x; int y; for(x = 0; x < maxM; ++x) { for(y = 0; y < maxM; ++y) printf("%f ", val[x][y]); printf("\n"); } } int main(void) { Matrice mat = { {1,2,3,4}, {5,6,7,8}, {9,10,11,12}, {13,14,15,16} }; Affichermat(mat); return 0; }
int mat[4][4] = { {1,2,3,4}, {5,6,7,8}, {9,10,11,12}, {13,14,15,16} };
int mat[][4] = { {1,2,3,4}, {5,6,7,8}, {9,10,11,12}, {13,14,15,16} };
int mat[][] = { {1,2,3,4}, {5,6,7,8}, {9,10,11,12}, {13,14,15,16} };
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionvoid Affichermat(Matrice val) { int x; int y; for(x = 0; x < maxM; ++x) { for(y = 0; y < maxM; ++y) printf("%d ", val[x][y]); printf("\n"); } }
gcc -W -Wall -Wextra -ansi -pedantic mat.c -o mat
mat.c: In function ‘Affichermat’: mat.c:13: attention : format ‘%d’ expects type ‘int’, but argument 2 has type ‘double’