A structure for an employee and a function to display the details of an employee:
struct employee
{
int emp_code;
char emp_name[30];
char emp_address[50];
char emp_ph_num[10]; int no_of_dep;
allEmployees[100],b;
void display()
{
int ctr=0;
fp=fopen("employee.c","r");
rewind(fp)
while(fread(&allEmployees,sizeof(allEmployees[i]),1
fp)==1)
{
ctr++;
clrscr();
heading();
printf("\n\n\n\
Following are the details :-");
printf("\n\n\tRecord #%d",ctr);
printf("\n\n\t\tCode : %d",allEmployees[i].emp_code)
printf("\n\n\t\tName : %s",allEmployees[i].emp_name)
printf("\n\n\t\tAddress : %s",allEmployees[i].emp_address)
printf("\n\n\t\tPhoneNumber:%s"allEmployees[i].emp_ph_num
printf("\n\n\t\tNumber.Dependents
%s",allEmployees[i].no_of_dep);
printf("\n\n\n\n\t\tPlease Press Enter...");
getch();
}
}