My scenario is as follows (VC++ code):
IDirect3DSurface9 ***ppp;
IDirect3DSurface9* p;
I call CreateOffscreenPlainSurface( , , ,&p,null) and now p will hold the address of D3D surface. So I want to assign p to ppp.
So I am doing
(*(*ppp)) = p;
But it’s throwing the runtime exception. I don’t understand why. Can anyone kindly help me in this?
This assignment throws an exception because you are writing to an address pointed to by an uninitialized pointer. You need to allocate memory for the pointer to a pointer array and then to the pointer array before you can make an assignment.
After you are done with these arrays, don’t forget to
delete[]them.If using pointers to pointers to pointers is not an explicit requirement, consider using
std::vector<std::vector<IDirect3DSurface9*> >instead.