I\'m asking this because my program have two functions to multiply matrices, they multiply only 4x4 and 4x1 matrices. The headers are:
double** mult4x1(doub
Although both double[N][M] and double** let you deal with 2D arrays, the two are definitely not equivalent: the former represents a 2D array of doubles, while the later represents a pointer to pointer to double, which can be interpreted (with the help of convenient square bracket syntax of C/C++) as an array of pointers to double, or as an array of arrays of double.
The double[N][M] represents 2D arrays of "rectangular" shape, while double** lets you build "free-form" (jagged) arrays by allocating different amounts of memory to each row of your matrix.
The difference to the compiler is that given double[N][M] and a pair of integers {r,c} it can compute the location of the element by computing the offset from the origin of the array, without reading anything from the memory. Given a double**, however, the compiler must compute the address of the pointer to a row, read that pointer, and only then compute the address of the target element. Because of this difference, the two are not interchangeable.