Pointer operand assignment

Hello,

I have a pointer array full of data. I am trying to create another pointer array, and access various bits of the data in that array to reorganize the data.

The problem is, this line of code:
(*pol1Card1+(i-1)) = ( (*pBuffer+(8*i-8)) + (*pBuffer+(8*i-6)) + (*pBuffer+(8*i-4)) + (*pBuffer+(8*i-2)) ) / 4;

Gives me an error of: lvalue required as left operand of assignment

But I do not want to check for equality, I want to set the pol1card1 array at a specified position = to the values in those pBuffer at the appropriate index, summed together and divide by 4.

How do I do this? I feel like a simpleton!

Maybe you wanted the following

*( pol1Card1+(i-1))

As for your original expression it looks like

( a + b ) = c;

Of course the compiler does not know what is the ( a + b ) to which it shall assign value c.
Thanks vlad. That fixed the compiling issues,

Now, the code is not behaving as I expected.
All it is, is noise, random junk. So I think I am not thinking this through correct.

I want to retrieve the actual value in pBuffer, and add it to 3 other actual values in pBuffer, and then divide by 4. So basically I am trying to take the average of 4 values from the pointer array.

Would this code do that?
Topic archived. No new replies allowed.