12 Sep
2010
12 Sep
'10
10:28 a.m.
This means lastZ and z are structures.
lastZ = z; // tdis initialization
I believe this make the structure lastZ point to the structure z. This is different than using:
lastZ.r = z.r; lastZ.i = z.i;
which moves the contents of z to lastZ, but leaves the pointers pointing to separate structures.
These are structs not pointers to structs so the members should be copied. I should have given the type definition for complex.
typedef struct complexStruct { double r; double i; } complex; so doing: complex lastZ; is the same as: struct complexStruct lastZ; and lastZ = z; should copy the members not copy a pointer. I hope this is right. I have the same thing in dozens of places. -- Mike Frazier www.fracton.org