i am trying to create an array of structures in C. it is as simple as reading in the information from a file into a structure, but I keep getting two warning messages about reading in my two character (number/colour) as well as that the program seems to just read zero for every value.
#include<stdio.h>
#include<string.h>
typedef struct car
{
int year;
char number[9];
char colour[10];
float engine;
} car_type[6];
int main()
{
car_type car;
int i;
FILE*fptr;
fptr = fopen("indata.txt", "r");
while (!feof(fptr))
{
fscanf(fptr, "%d %c %c %f", &car[i].year, &car[i].number,
&car[i].colour, &car[i].engine);
i++;
}
fclose(fptr);
return 0;
}