Key difference here being the != (not equal to) instead of your <= (less or equal to) which will fail when it tries to read the last element behind the end of the array.
RPGillespie,
if PlaneAlfa is a structure, and PlaneAlfa.Parties is a pointer, then PlaneAlfa.Parties[j] will return the jth element of Parties providing the pointer is actually to an array. Or to simplify, if Parties is an array Parties[j] will index the array and return its value.
pointer->data will return element data from a pointer to a class/structure called pointer. Assuming that what Kainunno said about his PlaneAlfa structure being a structure, and Parties being an array, then your code will try to dereference a value, which will fail.
Kainunno,
I'm not familiar with that error, but it sounds like the compiler isn't realising that cout is a stream, have you added the #define <iostream> directive?
Kainunno said "Parties is an array of pointers, containing names." Which means that he did something like this:
??? * Parties[x];
Where ??? is the type. He never specified what type of pointer Parties contains. If it is a pointer to a struct, he will use pointer->data, otherwise he will use (*pointer).
I have #include <iostream> and every other cout works.
I may just be completely misunderstanding pointers, so here's some of the relevant code.
My structures, Plane and Party:
1 2 3 4 5 6 7 8 9 10 11 12 13
#ifndef PLANE_H
#define PLANE_H
#include "Party.h"
struct Plane
{
long MaxSeats;
long NumSeatsOccupied;
long NumPartiesOnPlane;
Party * Parties;
};
#endif