2d-array

how can I return the index of an object in a 2 dimensional array?

I am working with a 2-D array of nullable booleans bool?[,]. I am trying to write a method that will cycle through its elements 1 at a time starting at the top, and for each index that is null, it will return the index. Here is what I have so far: public ITicTacToe.Point Turn(bool player, ITicTacToe.T3Board game) { foreach (bool? b...

how does C know dimensions of 2d dynamic array in a function?

I saw this example when I was trying to figure out how to pass pointers to dynamically allocated 2d arrays to functions: void zeroit(int **array, int nrows, int ncolumns) { int i, j; for(i = 0; i < nrows; i++) { for(j = 0; j < ncolumns; j++) array[i][j] = 0; } } I tried it and it works, but I don't understand how. How doe...

How do I hash a 2-d array efficiently (to be stored in a HashSet)?

I've written a class called PuzzleBoard that represents an nxn board. I will be keeping several PuzzleBoard objects in a HashSet, so I have to overwrite the 'int hashCode()' method. Below are the fields of my class: private int N; private int[][] puzzle; private int blankCellX; private int blankCellY; private int cost; What Ecli...

Creating a 2d Array having issues (C)

The code below is me trying to instantiate a 2d array, and it instantiating incorrectly: THE CODE: FILE* kernalFile = fopen(argv[1], "r"); int rKernalSize; fscanf(kernalFile, "%d", &rKernalSize); unsigned int rKernal[rKernalSize][rKernalSize]; Data froma break point right after that code is ran: rKernalSize VALUES: N...