I’m writing a C function for matrix multiplication. It takes two 2D arrays of ints. I could do this if I knew the dimensions of the input arrays, but I’d like to make a more general function.
How to find their dimensions, and how to return an array when I don’t know the product’s dimensions on compile-time?
You can’t find out the dimensions of an array if all you have is a pointer to the beginning of the array. You will need to pass the dimensions of the array to the functions.