Hello,
Can someone please explain to me because i do not understand the
tutorials on pointers.
anyways i have a struct:
struct driver {
int id;
char name[30];
int runs;
}
//I am reading a file which goes in order ID NAME RUNS as: 1 Super Man 5
//I am reading it from a file like so:
struct drive *read(char *file){
int x = 1;
FILE* open;
open = fopen(file,"r");
while(!feof(open)){
struct drive *drive1;
drive1 = (struct drive*) malloc(sizeof(struct drive));
drive1->stevilka=x;
fscanf(open, "%d", &drive1->id);
fscanf(open,"%s", drive1->name);
printf("%d", drive->id);
printf("%s", drive->ime);
}
}
What am i doing wrong here ?