I am trying to read input form the user and then print them to a file but the compiler is giving me some error about invalid pointer at the fprintf statements
void addrecord(void)
{
struct custinfo info;
FILE *customer;
printf("\n\n\t\t\t PLEASE ENTER THE CUSTOMER INFORMATION BELOW");
printf("\n\n\t\t\t REGSISRTATION NUMBER");
scanf("%d",&info.regis);
printf("\n\n\t\t\t FIRST NAME:");
scanf("%s",&info.fname);
printf("\n\n\t\t\t LAST NAME:");
scanf("%s",&info.lname);
printf("\n\n\t\t\t TREATMENT:");
scanf("%s",&info.treatment);
printf("\n\n\t\t\t ALLERGIES:");
scanf("%s",&info.allergies);
printf("\n\n\t\t\t DATE OF BIRTH (DD-MNT-YR):");
scanf("%d",&info.dob);
printf("\n\n\t\t\t DATE OF LAST APPOINTMENT (24):");
scanf("%d",&info.date);
printf("\n\n\t\t\t MONTH OF LAST APPOINNENT (07):");
scanf("%d",&info.month);
printf("\n\n\t\t\t YEAR OF LAST APPOINTMENT (1990):");
scanf("%d",&info.year);
customer = fopen("customer.txt","w");
if (customer!=NULL)
printf("\n\n\t\t\t FILE WAS OPENED");
else
{
fprintf("Registration Number:%d\n",info.regis);
fprintf("Customer Name:%s %s\n",info.fname,info.lname);
fprintf("Treatment:%s\n",info.treatment);
fprintf("Allergies:%s\n",info.allergies);
fprintf("Date of Birth:%s\n",info.dob);
fprintf("Last appointment date:%d-%d-%d\n",info.date,info.month,info.month)
}
fclose(customer);
}