Here is my code: The first, is the structure i use:
Then, i make a variable of that type, which i want it as an array later. I also have a counter.
typedef struct _SFont
Then, I have a function that increases the counter by one:
unsigned int counter;
I change the array size like that and attach a name to the current:
somewhy, this code doesnt work, but crashes. Is there another way i could use dynamic arrays?
rFont = (SFont*)realloc(rFont, sizeof(SFont)*counter);
sprintf (test, "ArrayItem %i", counter);
rFont[counter].name = test;