Dynamicly allocating an array of pointers
I have been having a spot of trouble making a dynamic array of pointers. Sanimation.sprite should be an array of sprite pointers. I am getting an "Incompatible types in assignment" error on the "new_animation->sprite[i] = ..." line. Because theres quite alot of irrelevant stuff I have pasted sniplets that should be enough to explain what I'm doing.
Code:
/* Animation structure */
struct Sanimation
{
struct Ssprite *sprite; /* Pointer to the array of sprites */
int count; /* How many sprites in this animation ? */
};
new_animation = malloc(sizeof(struct Sanimation));
new_animation->sprite = malloc(sizeof(struct Ssprite*) * spritecount);
new_animation->sprite[i] = load_sprite(filename,x,y,width,height,x_offset,y_offset);
struct Ssprite* load_sprite(char *file_name, int x, int y, int width, int height, int x_offset, int y_offset)
Thanks