void fill_garage(Car** garage, char* cars, int* size)
43 {
44 int i;
45 FILE* file=fopen(cars,"r");
46 fscanf(file,"%d",size);
47 *garage=malloc(sizeof(Car)**size);
48 printf("%d",*size);
49 for(i=0;i<*size;i++)
50 {
51 (*garage)[i].make=malloc(sizeof(char)*MAX_STRING_LEN);
52 (*garage)[i].model=malloc(sizeof(char)*MAX_STRING_LEN);
53 fscanf(file,"%d%s%s%d",(*garage)[i].year,(*garage)[i].make,(*garage)[i].model,(*garage)[i].miles);
54 }
55 fclose(file);
56 }
I am getting a segmentation fault on this code, gdb returns that the garage[i]->make line is the reason for this but I can not figure out why this line would case a seg fault.