Assanges, you have to keep in mind that when you are working with arrays you need to pass the full address of the position to which you want to make an assignment. The declaration and use of matrix and vector are different.
char vet[2]; //Isso é um vetor de duas posições
char matriz[2][5]; //Isso é uma matriz com 2 linhas e 5 colunas
Therefore, we can conceptually represent the arrangement of elements in memory as follows:
AfunfactaboutthearraythatwenormallydonothavetoworryaboutinPCprogrammingisthatalthoughthereisthis"theoretical" arrangement of elements in array format, elements are actually arranged in memory spaces sequentially , ie for the example above array [1] [0] in memory comes soon after array [0] [4]
One more fact about arrays is that when you refer to it this way "array [1]" you are pointing to the value of the memory address.
You can test with the example below:
#include <stdio.h>
#include <string.h>
int main(void){
char v2[2][5];
printf("%d", v2[0]); //Imprimirá um número X
printf("\n%d\n", v2[1]); //Imprimirá um número X+5, pois a linha 0 tem 5 colunas
return 0;
}
But finally, to assign a value to an array position you need to pass the position completely. Example:
char matriz[2][3];
matriz[1][2] = 'a';
The result would be: