The prototype

void Print_Sorted_Employee_Detail_To_File(FILE *report, int i, int i2, int index, 
		char full_name, float pay_rate, float hours, float ovt_hours,
		float gross, float federal_tax, float state_tax, float ssi_tax,
		float deferred, float net_pay);

The call:

Print_Sorted_Employee_Detail_To_File(report, i, i2, index[i], full_name[i],
      pay_rate[i], hours[i], ovt_hours[i], gross[i], federal_tax[i],
	  state_tax[i], ssi_tax[i], deferred[i], net_pay[i]);

This is the function definition, I'm sure there is something with the parameter passing here but compiler gives me 10 errors: subscript requires array or pointer type.

void Print_Sorted_Employee_Detail_To_File(FILE *report, int i, int i2, int index, 
		char full_name, float pay_rate, float hours, float ovt_hours,
		float gross, float federal_tax, float state_tax, float ssi_tax,
		float deferred, float net_pay)
{
   fprintf(report, "%55s\n\n\n", "In alphabetical order");
   for (i2 = 0; i2 < i; i2++)
   {
      fprintf(report, "          %-15.15s%6.2f%9.2f%9.2f%9.2f",
	     full_name[index[i2]],pay_rate[index[i2]],hours[index[i2]],
	     gross[index[i2]],federal_tax[index[i2]]);
      fprintf(report, "%8.2f%9.2f          \n%40.2f%18.2f%8.2f          \n\n\n",
		 ssi_tax[index[i2]],net_pay[index[i2]],ovt_hours[index[i2]],
	     state_tax[index[i2]],deferred[index[i2]]);
   }
}

before I moved it from main, it worked no problem. My brain must be sleeping cuz I can't figure out what's wrong.

not sure but I think I got it...

Yes!!! I got it to work, feel free to delete the topic.

grrrr, I got rid of compiler errors but now id won't print the results... sorry for going back and forth but it looks like i'm going to need help after all

ok now I got it for sure! I can't believe I spend so much time because the counter wasn't being incremented inside a function...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.