This is my second C assignment and we have been told to recreate a version of Conway’s Game of Life. I am using a struc (typedef) to hold my 2d array of ints for the grid created with:
typedef int TableType[HEIGHT][WIDTH];
HEIGHT & WIDTH are #define constants.
I am trying to use the function below to compare 2 tables. With the following error (no matter what way I try and compare the values):
error: expected expression before '==' token
int compareTables (TableType tableA, TableType tableB){
int height, width;
for (height = 0; height < HEIGHT; height++) {
for (width = 0; width < WIDTH; width++) {
if(tableA[height][width]) == tableB[height][width])
return LIFE_NO;
}
}
return LIFE_YES;
}
I am using Code-Blocks as my compiler and can’t seem to find a way to get gccx to work. So, as far as I know ‘stdio.h’ is the only library I can use.
I’ve tried importing pointers and manipulating those with the -> operator to get the values to compare to no avail.
I also use a similar method to copy tables and it seems to compile fine.
Any suggestions??
Please be gentle I’m a nOOb.
Thanks in advance.
should be