fortunately, I can run most part of my programme now, but still a little bit problem, I meet it frequently. Segmentation fault <core dumped> it seems like some problem like this, but I cannot find it easily, it must be happened in this two functions.
Code:
create(T1, i);
getserial(cityfc, citytc, sn, i);
void
create(SearchTree T, int num)
{
Position P;
char na[15], in[20], nn[15];
printf("Please enter you name:");
gets(na);
printf("Please enter your personal ID number:");
gets(in);
printf("Please enter your nationality:");
gets(nn); <=========Since here no problem
Insert(num, T);
P = Find(num, T);
strcpy(P->Information.name, na);
strcpy(P->Information.id, in);
strcpy(P->Information.nal, nn);
}
void
getserial(const char cityfc[], const char citytc[], char sn[], int i)
{
int array1[2], array2[2], counter;
for (counter = 0; counter < 3; counter++)
{
array1[counter] = (int) cityfc[counter];
array2[counter] = (int) citytc[counter];
}
sprintf(sn, "%d%d%d%d%d%d%d", array1[0], array1[1], array1[2], array2[0], array2[1], array2[2], i);
}
After that statement, segmentation fault <core dumped>