Hi. I would appreciate it if someone of you guys could help me with this one. after building and running the program enclosed it doesn't say the name of the highest earner. All it writes is "The highest earner is ".
typedef struct worker_struct
{
char name[];
long id_number;
int age;
unsigned int salary;
}worker;
void* read_data(worker* w)
{
int i;
for(i=0;i<SIZE;i++)
{
printf("Please enter worker number %d's name\n",i+1);
scanf("%s",w[i].name);
printf("Please enter worker number %d's ID number\n",i+1);
scanf("%li",&w[i].id_number);
printf("Please enter worker number %d's age\n",i+1);
scanf("%d",&w[i].age);
printf("Please enter worker number %d's salary\n",i+1);
scanf("%ui",&w[i].salary);
}
return 0;
}
int highest_earner(worker *w)
{
unsigned int highest_salary=0;
int i,n;
for(i=0;i<SIZE;++i)
if((w[i].salary)>(highest_salary))
{
(highest_salary)=((w[i]).salary);
n=i;
}
return n;
}
int main()
{
worker* wrk;
wrk=(worker*)calloc(SIZE,sizeof(worker));
int n;