Hi,

I've been tearing my hair out trying to pass an array to a function using pointers. I keep reading things that tell me an array is a pointer to a series of addresses, and then others that tell me this isn't quite true. So I have no idea what to do.

I am a student trying to do a homework and just can't seem to figure this one out.

The arrays are stu_count, stu_hours, and gpa.

Thank you for your help.Code:void get_input(int, int, float, int, int); float get_tot_hours(int, int); int get_stu_count(int); int rpt_out(int, int, float, int, int); void main(void) { int stu_hours[10] = {0}; int stu_num[10] = {0}; float gpa[10] = {0}; int stu_count = 0; int finish = 1; int *pfinish; int *pscount; pfinish = &finish; *pfinish = 1; pscount = &stu_count; *pscount = 0; while((stu_count < 11) && (finish != 0)) { //get_input(psnum, stu_count, pgpa, pshours, pfinish); get_input(*stu_num, pscount, *gpa, *stu_hours, pfinish); stu_count++; } //rpt_out(get_tot_hours(stu_count, pshours), get_stu_count(psnum), pgpa, pshours, psnum); rpt_out(get_tot_hours(stu_count, *stu_hours), get_stu_count(*stu_num), *gpa, *stu_hours, *stu_num); return; } void get_input(int *stu_num, int stu_count, float *gpa, int *stu_hours, int *pfinish) { printf("Please Input the 3 digit student code, or 0 to finish: "); scanf("%d", stu_num[stu_count]); if ((stu_num + stu_count) == 0) { pfinish = 0; } else { printf("\nPlease Input the hours for this student: "); scanf("%d", (stu_hours + stu_count)); printf("\nPlease Input this student's GPA: "); scanf("%f", (gpa + stu_count)); } return; } float get_tot_hours(int stu_count, int stu_hours) { float tot_hours = 0.0f; int ilocal = 0; for(ilocal = 0; ilocal < stu_count; ilocal++) { if((stu_hours + ilocal) != 0) { tot_hours += (stu_hours + ilocal); } } return tot_hours; } int get_stu_count(int stu_num) { int ilocal = 0; int total = 0; for(ilocal = 0; ilocal < 11; ilocal++) if((stu_num + ilocal) != 0) { total++; } return total; } int rpt_out(int tot_hours, int stu_count, float gpa, int stu_hours, int stu_code) { int ilocal = 0; printf("\nThe total hours for input students is: %d", tot_hours); printf("\nThe total number of students is: %d", stu_count); printf("\n\nStudent: \t Hours: \t GPA\n"); for (ilocal = 0; ilocal <= stu_count; ilocal++) { printf("\n%d \t\t %d \t\t %1.1f", (stu_code + ilocal), (stu_hours + ilocal), (gpa + ilocal)); } return 0; }

Tojam