I'm having another problem now, I switched the code that loads to the memory to a separate function, this one:

Code: Cpp
void memoria(FILE *fp, veiculo_t registo, veiculo_t *memptr)
        if (fp==NULL) printf("Impossivel aceder ou criar ficheiro\n\n");
        else {
            int c=0;
            while(fread(&registo,sizeof(registo),1,fp) != 0)
                memptr = realloc(memptr, (c+1)*sizeof(registo));
                memcpy(memptr[c].matricula, registo.matricula, 6);
                memcpy(memptr[c].proprietario, registo.proprietario, sizeof(registo.proprietario));
                memptr[c].apagado = registo.apagado;
            printf("\nFicheiro Carregado para a Memoria\n\n");

And in main, I call it as soon as the program opens it:

Code: Cpp
int main()
int opcao;
FILE *fp;
veiculo_t registo;
veiculo_t *memptr = NULL;

memoria(fp, registo, memptr);

fwrite(memptr[0].matricula, 6,1,stdout);
fwrite(memptr[0].proprietario, strlen(memptr[1].proprietario),1,stdout);

I get a segmentation fault on those fwrites in main(), I know the problem is somewhere in the use of pointers but isn't the memptr supposed to be passed as a pointer to the function?