I have come across one question:

find the size of two 2-D arrays when double pointers are given for them.Then find, if we can muliply these two matrices(those mathematics rules). finally we have to multiply the matrices.

I have asked this question(small part of this question) earlier also. someone answered that it is not possible to get the size like this. I aksed for the single-D array. I know same would be applied for the 2D arrays also. but, what might he be expecting from the person who is going to answer this? How can we find the sizes using double pointers passed to one function? Thanks in advance.

P.S This is not a homework. I don't want any code or link. I know how to multiply matrices and maths behind all this. :)

If all you have is a pointer, and it might be pointing to an element of an array, there is NO way to deduce the size of that array. Doesn't matter if it's 2D or 1D. If all you have is a pointer to an element in the array, you cannot tell how big the array is.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.