I've done a bit more work and have a bit more to show.
First I have redeclared the array:
Code:
int **mapSight = (int **)malloc(mapX * sizeof(int *));
for (int i = 0; i < mapX; ++i) {
mapSight[i] = (int *)malloc(mapY * sizeof(int));
}
Edit: The original mapSight was just int mapSight[mapX][mapY];
This has fixed some problems, however there is another array/function I am trying to do which are as follows:
The array
Code:
char **mapChar = (char **)malloc(mapX * sizeof(char *));
for (int i = 0; i < mapX; ++i) {
mapChar[i] = (char *)malloc(mapY * sizeof(char));
}
The function
Code:
void mapFill(char **map, int rows, int columns, char cell){
for(int i=0; i<columns; i++){ //initialise for loop to set seen to 0. This line go along y
for(int j=0; j<rows; j++){ //on each y co-ordinate go along the x
map[j][i] = cell; //for each co-ordinate x and y set the seen value to 0 [or 1 to reveal map]
}
}
}
And now I get a new error of:
cannot convert `char**' to `int**' for argument `1' to `void mapFill(int**, int, int, char)'
Edit 2: I now managed to get rid of that error and it compiles (I prototyped wrong) now it crashes. I'm not sure if it is creating the mapChar array properly