struct match
{
char men[64];
char women[64];
char menNum[1000];
char woNum[1000];
};
void printOut();
int matchMaking(struct match* p, struct match* q, int k);
int main(void)
{
FILE* fin;
FILE* fout;
fin = fopen("input.txt", "r");
fout = fopen("out.txt", "w");
int matchNum = 0;
int size;
int i;
int j;
int a;
struct match* ptrName;
struct match** ptrNum;
char* str;
char temp[800];
if(fin == NULL)
printf("Cannot Find File");
fgets(temp, 800, fin);
str = (char*)malloc(sizeof(char));
str = (char*)strtok(temp, " \n");
size = atoi(str);
printf("Size = %d\n", size);
ptrName = (struct match*)malloc(size*sizeof(struct match));
ptrNum = (struct match**)malloc(size*sizeof(struct match*));
for(i = 0; i < size; i++)
{
fgets(temp, 800, fin);
str = (char*)strtok(temp, " \n");
matchNum = atoi(str);
printf("Match Num = %d\n", matchNum);
fgets(temp, 800, fin);
strcpy(ptrName->men, temp);
printf("Name = %s\n", ptrName->men);
fgets(temp, 800, fin);
strcpy(ptrName->women, temp);
printf("Name = %s\n", ptrName->women);
for(j = 0; j<matchNum; j++)
{
fgets(temp, 800, fin);
strcpy(ptrNum[j]->menNum, temp);
printf("Men Num = %d\n", ptrNum[j]->menNum);
}
when debugging I keep getting a segmentation fault as an error