Hi can someone explain to me how the following can be done:
exampleArray[1] = 5
even though exampleArray is a 2d array? Ive come across this in some c++ source code ive been looking at and wasn't sure what it was doing. Is it that it is entering this '5' into the first position of the 2d array? The array was initially declared as:
Where did you find two-dimensional array?!
There is declaration of a vector of doubles 10000 ( 100 * 100) elements of which are zero initialized. In fact it is a one-dimensional array which has 10000 elements that were initialized with zero.
thanks for that hanst99, in your example of organizing it like 1d indices, then how would you access the data at for example '8+3', would it be exampleArray[11]?
If you have a 2D array, you may access to any posicion with myArray[ i ][ j ], beside, if you have a 1D array but you want the behave as a 2D you'd do myVector[i*COLS + j];