I want to initialize an array of strings with the same value to every position. So i am trying this code:
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
#define TAM_VETOR 1009
#define QTD_PLACAS 1000
void inicializaVet(char * v[], int tamVet) {
int i;
for (i = 0; i < tamVet; i++) {
printf("rodou %d\n", i);
strcpy(v[i], "vazio");
}
}
int main(void) {
char vetor[TAM_VETOR][8];
inicializaVet(vetor,TAM_VETOR);
return 0;
}
It does not work and can not copy even to the first position. (Prints "rodou 0" then breaks)
geraArquivo() is working.
I have tried to put the same code under the main function and it worked, i guess my mistake is on the types of arguments "inicializaVet" has? But i could not figure it out on my own.