typedef struct grid Grid;
struct grid{
char grid[MAX_ROW][MAX_COL];
}
void storeGrid(Grid *store_grid,int row, int col){
Grid *store_grid;
store_grid = (Grid)malloc(sizeof(Grid));
//Grid storeGrid;
//int grid[MAX_ROW][MAX_COL];
int rowNum, colNum;
for(rowNum = 0; rowNum <= row; rowNum++){
for(colNum = 0;colNum < col; colNum++){
store_grid->grid[rowNum - 1][colNum] = 'a';
}
}
// Calls the PrintGrid function, which prints out the grid
//printGrid(storeGrid.grid,row,col);
}
I edited this code in order to change values in the 2d array directly but this doesnt seem to be working. So i was wondering if any1 could make suggestions so that i can directly edit the 2d array in the struct rather then copies being made in the function and then dissappearing after the function has ended.
Thanks.