-1
I need to create a vector that stores matrices and print these matrices. What would be the correct way to do the assignment and print the matrices through the vet
?
int main()
{
int *vet;
int **mat;
int i, j;
vet = (int*)malloc(2*sizeof(int));
mat = (int **) malloc (2 * sizeof (int*));
for( i=0; i<2 ; i++) {
mat[i] = (int*) malloc (3 * sizeof(int));
}
//Atribuir matriz ao vetor
//Preencher matrizes
for( i=0; i<2 ; i++) {
for( j=0; j<3 ; j++) {
mat[i][j] = 1;
}
}
//Imprimir matrizes
for(i = 0; i < 2; i++) {
//printf(" %d \n", vet[i]);
}
}