Can anyone see what I am doing wrong?
Yes, and I can illustrate the issue in a test program for you:
#include <stdio.h>
void reset(int value)
{
value = 123;
}
int main(void)
{
int x = 0;
reset(x);
printf("%d\n", x);
return 0;
}
value is a copy of the original object, not a reference to it. Thus when you modify value , the original object does not change, and the output of this program will be 0 instead of 123. The thing is, if you add a level of indirection such that x becomes a pointer, that changes nothing, and if you look at your definition of populate_bricks(), sprite_pointer is being modified yet it's a copy of the original object.
Since you're clearly compiling as C++ rather than C, you can make that parameter a reference and nothing else needs to change:
void populate_bricks(const char **_sprite_bmap_names, sprites*& sprites_pointer, int &sprites_size) Narue
Bad Cop
Administrator
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401