Please help me finish my assignment.
Can someone please help me finish my assignment i am so frustrated i tried everything ..
i am trying to write a function that lists all the student records in linked lists in the hash index. The records are printed in the following order: the records in the list headed by hashtable[0] are printed first in the ascending order of the student_id, then the records in the list headed by hashtable[1] are printed in the ascending order of the student_id and so on.. the order of the printed records depends on the positions of the records in the hash index. Each record is printed in the following format :
student_id:lastname:firstname:gpa
if there is no record in the hash index, print:
no record
the function is :
void listRecords(Student **hashtable);
So this is what i've done so far but it still doesn't work:
{
int i, j;
Student temp;
Student *s;
for(i=0; i<HASHTABLESIZE; i++)
{
for(j=i; j<HASHTABLESIZE; j++)
{
if(s[i].student_id > s[j].student_id)
{
temp = s[i];
s[i] = s[j];
s[j] = temp;
}
}printf("%d:%s:%s:%.1f\n", s->student_id, s->lastname, s->firstname, s->gpa);
if(s[i].student_id != s[j].student_id)
{
printf("no record\n");
}
}
}