0
In the classroom, students were asked to replicate a scheme designed by the teacher. In this scheme he made a vector, within each position he made a matrix and within each position of the matrix he drew a structure containing name, address and age. Let it be clear that I’m not asking you to solve for me, I just want you to explain to me the logic of this exercise.
Follow my code so far:
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
struct Pessoa{
    char nome[40];
    char endereco[100];
    int idade;
};
void mostrar(Pessoa vetor[][2]){
    for(int i=0; i<2; i++){
        for(int j=0; j<2; j++){
            printf("\nCOD-%d\n", i);
            printf("\tNome: %s", vetor[i][j].nome);
            printf("\n\tEndereco: %s", vetor[i][j].endereco);
            printf("\n\tIdade: %d", vetor[i][j].idade); 
        }
        printf("\n");
    }
}
int main(void){
    Pessoa clientes[2][2];
    for(int i=0; i<2; i++)
        for(int j=0; j<2; j++){
            fflush(stdin);
            printf("\nCOD-%d%d\n", i,j);
            printf("\tNome: ");
            gets(clientes[i][j].nome);
            printf("\tEndereco: ");
            gets(clientes[i][j].endereco);
            printf("\tIdade: ");
            scanf("%d", &clientes[i][j].idade); 
        }
    system("cls");
    mostrar(clientes);
    return 0;
}
This was the code I made, but I still need the client matrix to stay within a vector[3].
– Gabriel Antunes
How so I didn’t understand your doubt so... you want it to have one more row and one more column?
– Anderson Henrique
At the moment I was able to make a struct matrix, to get to what the teacher asked for, it is missing to place this matrix inside a vector (each vector position will have a struct matrix)
– Gabriel Antunes
I will edit the publication
– Anderson Henrique