int a[1][1];

a[0][0] = 1;

Why must I use the deference operator twice to get the value at a[0][0] (**a).

Why isn't it just *a like it is in a non multidimensional array?

Any help would be greatly appreciated!

a[0][0] = 1;

Why must I use the deference operator twice to get the value at a[0][0] (**a).

Why isn't it just *a like it is in a non multidimensional array?

Any help would be greatly appreciated!

It's the simple fact that

In any case, the general rule is

`*a == a[0]`

. It wouldn't make sense for `*a`

to be both `a[0]`

and `a[0][0]`

.In any case, the general rule is

`*(a+i) == a[i]`

so if you want `a[0][0]`

, you'll need `*(*(a+0)+0)`

or simply `**a`

.
Last edited on

Topic archived. No new replies allowed.