Hi, all--
I'm working on an airline reservation program, and I think I've gotten myself all turned around with respect to the pointers. Here's the relevant code:

Code:
typedef struct
{
	int number; //flight number
	char *origin; //dynamically allocated
	char *destination; //dynamically allocated
	int passengerIDs[3][4];
	short passenger_count;
} Flight;

void read_flights(const char *filename, Flight **flights, int num_flights, int last_ID)
{
	FILE *fp;
	char fn[80], skip_ch;
	int i, status;
	sprintf(fn, "%s.csv", filename);
	fp = fopen(fn, "r");
	
	for(i = 0; status != EOF && i < num_flights; i++)
	{
		status = fscanf(fp, "%d%c", flights->number, &skip_ch);
		while(flights->origin != ',')
		{
			fscanf(fp, "%c", flights->origin);
			flights->origin++;
		}
		
		
	}//read csv file into flights array
	
}//read_flights

int main(int argc, char *argv[])
{
	int choice, num_flights, last_ID;
	get_flights_info(argv[1], &num_flights, &last_ID);
	Flight *flights[num_flights];
	read_flights(argv[1], flights, num_flights, last_ID);
}//main
My primary problem is this error message: "error: request for member ‘number’ in something not a structure or union"
It gives the same message for all the lines in red. If I'm understanding this correctly, for some reason, GCC isn't recognizing that flight is a struct. IIRC, C passes arrays as a pointer to the first element, so passing "Flight *flights" would effectively be the same as passing "Flight flights[]", but "Flight **flights" has me completely baffled. As best I can figure, it's... passing the address of the flights array? The instructor assured us that it was necessary, since we would need to dynamically allocate the array.

Which leads to my second problem: the instructor had no get_flights_info function--I just couldn't figure out how to make GCC stop complaining that *flights[] had no size without first reading the number of flights from the input file. flights[] is also not supposed to be an array of pointers--in short, main() is supposed to read something like this:

Code:
int main(int argc, char *argv[])
{
	int choice, num_flights, last_ID;
	Flight flights[num_flights];
	read_flights(argv[1], &flights, &num_flights, &last_ID);
}
I changed it because I kept getting an incompatible pointer type warning for argument 2 of read_flights.

If anyone could help me out with either of these problems, I'd much appreciate it.