Hello again,
When I call the method below and try to print out the results I'm getting a segmentation fault, however if I print out the return value before returning it then it all works fine. I've tried using gdb when it fails to check the return value and does point to the correct object, so I don't understand why I'm getting the fault. Could anyone explain why, and possibly what I'm doing wrong?
Note: 'polarField' extends 'Field'
In this method, I want to ensure that a pointer to the exact object in the original list is returned, rather than a copy of it.
Many thanks in advance.
My guess is that you're getting a segmentation fault because when you assign the pointer to *closest, you haven't initialized **closest.
I think you should try to change closest to be a pointer and not to a pointer to a pointer. Then make sure you change all relating pointer syntax of course.