C in UNIX environment; external bubble sort doesn't work
Code:
void BubbleSort(EmployeeRecord employees[], int max_employee); //3.12
void BubbleSort(EmployeeRecord employees[], int max_employee) //3.12
{
int o, i;
for (o = 0; o < MAX_EMPLOYEE; o++)
{
for (i =0; i < MAX_EMPLOYEE - 1; i++)
{
if (strcmp(employees[i].lastname,employees[i+1].lastname)>0)
{
EmployeeRecord tempRec = employees[i];
employees[i] = employees[i+1];
employees[i+1] = tempRec;
}
}
}
}
I'm trying to make an external bubble sort that will sort a record of employees. All of that above is my external bubble sort function. I'm still not quite used to using Linux, but I'm using PuTTY to connect to my school's Linux servers and using Pico/GNU nano 1.3.8 to write this. When I gcc it, I get the following errors:
Quote:
sort.c:1: error: expected â)â before âemployeesâ
sort.c:3: error: expected â)â before âemployeesâ
make: *** [sort.o] Error 1
I just can't figure out why I'm getting that error. When I put the function back into the main source file, the sort works fine. As an external function, however, it doesn't work. What did I miss here?
Here's my main source file up until int main(void):
EDIT: "float ........itax" should read "*s_s_itax" without the underscores. I'm guessing a censor is filtering it out.
Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define FEDTAXRATE 0.15
#define STATETAXRATE 0.07
#define SSITAXRATE 0.0775
#define OVERTIME 40
#define FORMAT1 " %-25s %5.2f %7.2f %7.2f %7.2f %6.2f %7.2f\n"
#define FORMAT2 " %7.2f %7.2f %6.2f\n\n"
#define MAX_EMPLOYEE 5
typedef struct EmployeeRecord
{
char lastname[20+1];
char firstname[20+1];
float payrate;
float hours;
float defr;
float net;
float reg_hours;
float ovt_hours;
float gross;
float ft, st, ssit;
} EmployeeRecord;
void PrintReportHeadings(FILE * report); //3.1
void InitializeAccumulators(float *tot_payrate,
float *tot_reghours,
float *tot_ovthours,
float *tot_gross,
float *tot_fed,
float *tot_state,
float *tot_SSI,
float *tot_defr,
float *tot_net); //3.2
void InputWorkerData(char *lastname,
char *firstname,
float *hours,
float *payrate,
float *defr); //3.3
float CalcGross (float hours,
float payrate); //3.4
void CalcTaxes(float gross,
float defr,
float *fedtax,
float *statetax,
float ........itax); //3.5
float CalcFedTax(float gross,
float deferred); //3.5.1
float Calcstatetax(float fedtax); //3.5.2
float CalcSSITax(float gross,
float deferred); //3.5.3
void AddDetailToAccumulators(float *tot_payrate,
float *tot_reghours,
float *tot_ovthours,
float *tot_gross,
float *tot_fed,
float *tot_state,
float *tot_SSI,
float *tot_defr,
float *tot_net,
float *fedtax,
float *statetax,
float ........it,
float gross,
float reg_hours,
float ovt_hours,
float payrate,
float defr); //3.6
extern float CalcNetPay(float gross,
float *fedtax,
float *statetax,
float ........itax,
float defr); //3.7
void CalcAverages(float *tot_payrate,
float *tot_reghours,
float *tot_ovthours,
float *tot_gross,
float *tot_fed,
float *tot_state,
float *tot_SSI,
float *tot_defr,
float *tot_net,
FILE * report); //3.8
void PrintTotAvg(float *tot_payrate,
float *tot_reghours,
float *tot_ovthours,
float *tot_gross,
float *tot_fed,
float *tot_state,
float *tot_SSI,
float *tot_defr,
float *tot_net,
float avg_payrate,
float avg_reghours,
float avg_ovthours,
float avg_gross,
float avg_fed,
float avg_state,
float avg_SSI,
float avg_defr,
float avg_net,
FILE * report); //3.9
void CalcHours(float *hours,
float *reg_hours,
float *ovt_hours); // 3.10
void PrintEmployeeData(EmployeeRecord employees[],
int count_emp,
FILE * report); //3.11
extern void BubbleSort(EmployeeRecord employees[], int max_employee); //3.12