hi guys,Iam learning the c language and still a green one really.I have this program am trying to develop using code blocks 10.5.Th code is as follows;
#include<stdio.h>
#include<ctype.h>
#include<stdlib.h>
struct secguard
{
char first_name[40];
char Last_name[40];
char gender;
int age;
int ID;
char start_date;
int work_rec;
};
void main(void)
{
struct secguard guard_rec[300];
FILE*GUARD_DETAILS;
char operation;
char gender;
if((GUARD_DETAILS=fopen("security.dat","wb+"))== NULL)
{
printf("File can't open!");
}
else
{
switch(operation)
{
printf("Please choose the operation you want to perform.\n");
scanf("%c",operation);
{
case 'A' :printf("Add record(s) to the database.\n");
break;
case 'U' :printf("Update record(s).\n");
break;
case 'Q' :printf("Query database to obtain information.\n");
break;
default :printf("Undefined operation!");
break;
}
if(operation=='A'||operation=='a')
{
printf("Please,enter surname.\n");
fflush(stdin);
gets(guard_rec.first_name);
printf("Please,enter lastname.\n");
fflush(stdin);
gets(guard_rec.Last_name);
printf("Please,enter gender.\n");
scanf("%c",&gender);
}
else
{
printf("Sorry you have no more choices!");
}
}
}
fclose(GUARD_DETAILS);
}
when I compiled this code,it generated errors both being of the same nature.it read that first_name is a member of something that isn't a structure or union.Now,where could I have gone wrong?This is just a small extract.