0
I’m trying to create a matrix to read the names of 5 students.
#include <stdio.h>
#include <stdlib.h>
    
int main(void){
    //Programa para calcular a média das notas de 5 alunos, sendo que cada aluno possui 3 notas.
   char nomes[5][30];
   float notas[5][4];
   float media[5];
   int cont1, cont2;
    
       
   //Leitura dos nomes e das notas de cada aluno.
   for(cont1 = 0;cont1 < 5; cont1++){
      scanf("%s", &nomes[cont1][30]);
   }
    
   //Imprimindo os nomes para testar
   for(cont2 = 0;cont2 < 5; cont2++){
      setbuf(stdin, 0);
      printf("\n%s", nomes[cont2]);
   }
    
   return(0);
}
The code is working to read the 5 names, however it displays only 3 names and presents the error zsh: abort. What might be going on?
In this case, what I described is being considered a vector or a matrix?
– user196549
@user196549
char nomes[5][30]is a vector of vectors ofchar, or is a matrix ofchar. Basically matrices are vectors that store vectors.– user72726