Some time ago I asked a question in which I was told (in the commits) that using the term "multi-dimensional array" for a construct like this:
int **a;
Initialized like this:
a = malloc(n * sizeof(*a));
for (i = 0; i < n; ++ i)
a[i] = malloc(m * sizeof(*a[i]));
is misleading and that this is "only an emulation of " a multi-dimensional array. Not being a native English speaker, I am having a hard time figuring out what is the proper terminology. Unfortunately, the guy who complained about the terminology was of no help himself.
Sure enough, the term "emulation of multi-dimensional array" is too long to be actually used in text/conversation.
To sum up:
- What is the proper terminology for the construct above (specifically in C, if that makes a difference)?
Side question:
- Is this terminology language agnostic? If not, how is it called in C++ for example?
Note: I'd be happy if your answer is linked with a reference.
Edit: I understand the difference between this construct and int a[n][m];
. That's not the question.
Update
The memory allocated is not necessarily regular. This construction is more precise:
a = malloc(n * sizeof(*a));
for (i = 0; i < n; ++ i)
if (needed[i])
a[i] = malloc(m[i] * sizeof(*a[i]));
else
a[i] = NULL;