Ciao, allora ho una struttura cosi:
typedef struct InmDefectsTwoDimFrame
{
int frameNr;
int nr;
InmDefectRect *defects;
}
InmDefectsTwoDimFrame;
dove
typedef struct InmDefectRect
{
int ID;
int type;
int weight;
InmImageCoordPoint dimension;
InmWorldCoordPoint position;
InmDefectRelation relation;
}
InmDefectRect;
Io voglio che la struttura InmDefectsTwoDimFrame contenga un array di tipo InmDefectRect il quale venga aggiornato dentro un for aggiungendo elementi. Mi potreste dire come fare l'allocazione della momoria, perchè attualmente faccio così e mi viene dato errore a runtime quando fa il secondo realloc:
*defectsFrame = (InmDefectsTwoDimFrame *) realloc(*defectsFrame, (totalTwoDimdefects + boxesSize) *sizeof(InmDefectsTwoDimFrame **));
(*defectsFrame)->defects = (InmDefectRect *) realloc((*defectsFrame)->defects, (totalTwoDimdefects + boxesSize) * sizeof(InmDefectRect));
spero che sapete dirmi qualcosa
Grazie