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.Code:typedef struct _SFont { ID3DXFont *Fontobj; char *name; LOGFONT FontParams; }SFont;
Then, I have a function that increases the counter by one:Code:unsigned int counter; SFont *eFont; char test[30];
I change the array size like that and attach a name to the current:Code:counter++;
somewhy, this code doesnt work, but crashes. Is there another way i could use dynamic arrays?Code:rFont = (SFont*)realloc(rFont, sizeof(SFont)*counter); sprintf (test, "ArrayItem %i", counter); rFont[counter].name = test;



LinkBack URL
About LinkBacks


