I'm rather new to C and sometimes I come across strange notations, especially in relation with pointers.
A very short example:
....
real *ptr;
real delta_force;
for(i<particles;...)
{
...some calculations
ptr=&FORCE(i,...); //FORCE is a macro returning the current force on a particle
*(++ptr) += delta_force;
...
}
...
How can I interpret *(++ptr)
?
First increment pointer and then add delta_force
to the value pointed to by the pointer.
*(++ptr) += delta_force;
means same as
ptr = ptr + 1;
*ptr = *ptr + delta_force;