This is what I have tried. Please let me know if this is fine:
Code:
typedef struct
{
char Name[10];
char Address[10];
char Street[10];
char City[10];
char State[10];
char Country[10];
}DETAILS;
Code:
int main ()
{
DETAILS *detailsArray = NULL;
int i = //Find out the maximum number of rows the structure needs to hold.
detailsArray = (DETAILS *) calloc (i , sizeof(DETAILS));
for (int j=1 ;j<i ; j++)
{
strcpy(detailsArray[j].Name , intputaddress[j]);
strcpy(detailsArray[j].Address , intputaddress[j]);
....
.....
}
//At the End of the function
free(detailsArray);
return 0;
}
Also , does the free( ) deallocate ALL members of the structure ( The char arrays . Note that they are char arrays and not char pointers) ?
Thanks.