1
C / Re: Create a double array of sfSprite
« on: February 27, 2018, 04:48:42 pm »So you just want a classic 1D array.sfSprite** sprites;
sprites = malloc(3 * sizeof(sfSprite*));
sprites[0] = ...;
sprites[1] = ...;
sprites[2] = ...;
Note that this is basic C stuff, so maybe you should spend more time learning C before trying to do more complicated things.
I know it just basic stuff in C. But in basic C we just use pointer of char, void and int and the sfSprite type do not exist. I know that the sfSprite is a structure create for sfml and I thought It would be different. And I already try that. Check my first message I show you what I have tried. I have try exactly the same thing but it don't work.
Sorry it's been a year that im learning c.
Found the solution thank you everyone. I just changed my malloc from:
malloc(sizeof(sfSprite) * n); to
malloc(sizeof(*sprite) * n)
And it work now
Envoyé de mon iPhone en utilisant Tapatalk