I have been searching (google and books) for an answer to this question for a long time without managing to find any answer worth the name, so I'll try posting a thread hoping for better luck.
Can someone explain to me why this:
Aclass **tmp, *aclass[10];
tmp = aclass;
or this:
Aclass ***tmp, **aclass[10];
tmp = aclass;
is okay, while this:
Aclass ***tmp, *aclass[10][10];
tmp = aclass;
or this:
Aclass **tmp, aclass[10][10];
tmp = aclass;
is not.
What I've managed to "figure out" so far is that is has to do with a double pointer not really being the same as a pointer array, just that they happen to be (in lack for a better word) "compatible" in the first cases. But, since I obviously don't quite understand the full mechanics I can't see why they shouldn't continue to be compatible for higher order arrays.
My primary question though is whether it is possible in C++ (or C) to create a new reference to a multi-dimensional pointer array (in my example so I can continue manipulating aclass
using tmp
) and if so/or not how this be done/or worked around, working only with ordinary arrays (not Array or vectors). Obviously in a case where I do not know the size of aclass
before hand which would make the problem very trivial.
Simply put, solving this case:
Aclass ***tmp, *aclass[10][10];
tmp = aclass;
is my main concern, and any knowledge beyond that will "merely" be appreciated for what it is.
I will be bowing to who ever manages to answer this question for a very long time. ;)