2 ms·
You are mistaken there. An array `int arr[10][20][30];` is a single contiguous (stack) allocation. I recommend you read up on what pointer decay actually does;
by ynik 2y ago
You are mistaken there.
An array `int arr[10][20][30];` is a single contiguous (stack) allocation.
I recommend you read up on what pointer decay actually does; it's more complicated than replacing all arrays with pointers!
In particular, the type of an `arr` expression (after decay) is `int(*)[20][30]`.
Decay only ever changes the top-level (outermost) type! And the type of `&arr` is even `int(*)[10][20][30]` -- using `&` or `sizeof` prevents decay from happening.
Pointers to arrays are rarely used because using decay is more idiomatic (and because their syntax is unwieldy), but they still exist and would be safer than using decay.