I want to make a function which takes an existing 9x9 empty array of integers, and inserts values taken from a file (so the function also gets the file name as input). But I cant really figure out how to do this properly, even though I've tried quite a few different methods. Basically, here is what I do:
int board = new int[9][9] //The empty array
int addToArray(int *board, string filename) {
/* Code to insert values in each field is tested and works so
I will just show a quick example. The below is NOT the full code */
int someValue = 5;
board[0][0] = someValue;
/* Return a value depending on whether or not it succeeds. The variable 'succes'
is defined in the full code */
if (succes) {
return 0;
} else {
return -1;
}
}
This is a very reduced example, compared to the actual code, but it is overall function of passing a pointer to a an array into some function, and have that function modifying the array, that I want. Can anyone tell me how to do this?