2
I put nine digits in the vector but my matrix comes out with random numbers, I would like my matrix to come out with the numbers that are in the vector below my code:
#include <stdio.h>
#include <locale.h>
int vetor [9];
int matriz [3][3];
int i=0, lin=0, col=0, k=0;
main(){
setlocale(LC_ALL, "");
printf("Digite 9 número para uma matriz \n" );
for(i=0;i<9;i++){
scanf("%i", &vetor[i]);
}
for(lin=0;lin<3;lin++){
for(col=0;col<3;col++){
matriz[lin][col] = vetor[k];
k++;
printf("%i\t", &matriz[lin][col]);
}printf("\n");
}
}
What I’m doing wrong?
Thanks bigown, I’m beginner in the language helped a lot!
– G.Carlos