Quote Originally Posted by Scupham View Post
I tried changing the struct etc as you said, but this created errors later on in text.
The point is that you can so everywhere and eliminate the temporaries.
Just as you assign like &something, just type that &something instead of the temporary variable when passing arguments.

Can anyone see which pointer is leading my program astray?
I can only see you using an unitialized pointer. So how you got those results at all is beyond me.
You are also allocating memory with malloc without freeing it with free.

And your code is horribly indented, it's difficult to read.