IDirect3DSurface9 *var = NULL;
IDirect3DSurface9 *** ret;
I want to assign the value dereferenced by var into the variable pointed by ret.
I did the foll:
(*(*(ret[0]))) = var;
I feel this is correct C++ syntax. But why is that I am getting compilation error as follows:
error C2679: binary '=' : no operator found which takes right hand operand of type "IDirect3DSurface9 *" (or these is no acceptable conversion).
What is the correct syntax?
You have de-referenced the pointer 3 times. Once when you treated it as an array and used the index [0]
, and then twice more with the *
operator. In order to be compatible with var
you should de-reference only twice.
To be more explicit, let's break this down:
ret
has type IDirect3DSurface9***
.ret[0]
has type IDirect3DSurface9**
.*(ret[0])
has type IDirect3DSurface9*
.*(*(ret[0]))
has type IDirect3DSurface9
.And clearly it follows that *(*(ret[0]))
is not assignment compatible with var
which has type IDirect3DSurface9*
.
As to what your code really should be, I could not say for sure, but you will need to remove one level of indirection.