assigning one structure to another using pointers

Hi,
i have two pointer to stuctures named *currMB and *PrevMB and i want to assign PrevMB into currMB.
will the C++ code below work.

struct Macroblock *currMB;
struct Macroblock *PrevMB;

*currMB= & PrevMB;

and if i want to average these two structures and put the output in currMB.

then can i write

currMB = (currMB+PrevMB)/2;


Macroblock is the structure
Macroblock mb would declare a Macroblock object called 'mb'
Macroblock *currMB is a pointer to a Macroblock object.
To assign the address in PrevMB to currMB write currMB = PrevMB;
To assign the object pointed by PrevMB to the one pointed by currMB write*currMB = *PrevMB;
If you want to find the average of the two objects (I'm assuming that you have overloaded + and / operators), write *currMB = (*currMB+*PrevMB)/2;
Topic archived. No new replies allowed.