Here is some example code for allocating memory for your records and then deleting it:
int iter = 0;
records *ptr; /* For the array of records */
ptr = (record*)calloc(numRecords, sizeof(record));
for(i = 0; i < numRecords; i++)
{
ptr[i] = (record)calloc(1, sizeof(record));
/* if you need to allocate mem for record fields, do it here */
/* copy record data here */
}
for(i = 0; i < numRecords; i++)
{
/* if you allocated mem for record fields, delete them here */
free(ptr[i]);
}
free(ptr);