I'm working from my knowledge of pointers... OK, so it's not possible. I didn't know that, I never actually tried. But a[10] works, nevertheless, and which just compiles to a + sizeof(a) * 10. So why wouldn't 2D work?
Unless, of course, there is a way to cast that pointer to a type that is a 2D-pointer.
I disgress. Sometimes others can fill out what someone else cannot. We aren't perfect.
Otherwise, it's possible to do
Code:
*(p + sizeof(p) * x * y) = y
Or
Code:
int& array(int* p, int x, int y)
{
return *(p + sizeof(p) * x * y);
}
int main()
{
int* p = new int[100];
array(p, 10, 2) = 50;
}