You are trying to update element 0 in your collection, a pointer to a test_t instance, with itself.
Unfortunately the CArrayObj implementation doesn't check this and so it deletes exactly the same pointer you are turning in. Result of this operation is that you lost your test_t instance and any access to it will be invalid.
Learn about classes, instances and pointers thereof before going on.
PrintFormat("Before obj[0].a = %f", r.a); r.a = 3.0; //obj.Update(0,r); PrintFormat("After obj[0].a = %f", r.a);
You are trying to update element 0 in your collection, a pointer to a test_t instance, with itself.
Unfortunately the CArrayObj implementation doesn't check this and so it deletes exactly the same pointer you are turning in. Result of this operation is that you lost your test_t instance and any access to it will be invalid.
Learn about classes, instances and pointers thereof before going on.
Thanks
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello,
Could someone tell me how to fix this code please? It's exiting with an invalid pointer after the Update operation.
What am I doing wrong please?