struct GENERATIONS
{
char generation[MAX_ROWS][MAX_COLS];
int hasCycle;
};
typedef struct GENERATIONS Generation;
I have an array of type struct:
Generation generations[MAX_GENERATIONS];
I declare a Generationvariable like this:
Generation *currentGeneration = NULL;
currentGeneration = (Generation *) malloc(sizeof(Generation));
and attempt to add a generation to an array of generations: numGenerations is set to 0 then incremented via a loop.
copyGeneration(currentGeneration);
generations[numGenerations] = currentGeneration;
Yet each time, I get the error incompatible types when assigning to type 'Generation' from type 'struct Generation *. I understand this has to do with pointers which I do not understand but need.
Why is it that when I declare the array as:
Generation *generations[MAX_GENERATIONS];
Everything suddenly works?