I'm trying to sort a structure, but I keep getting errors. Can anyone tell me what's wrong with me code? Thanks!
void sortindex(int index_c)
{
int i, hold, pass, swap;
for (pass = 1; pass <= index_c; pass++) {
swap = 0;
for (i = 0; i < index_c - pass; i++) {
if ((indxfrec_t) > (indxfrec_t[i + 1])) {
swap = 1;
hold = indxfrec_t;
indxfrec_t = indxfrec_t[i + 1];
indxfrec_t[i + 1] = hold;
}
}
if (!swap)
break;
}
for (i = 0; i < index_c; i++)
printf("\n%s\t%ld", indxfrec_t.partid, indxfrec_t.recoffset);
}
void sortindex(int index_c)
{
int i, hold, pass, swap;
for (pass = 1; pass <= index_c; pass++) {
swap = 0;
for (i = 0; i < index_c - pass; i++) {
if ((indxfrec_t) > (indxfrec_t[i + 1])) {
swap = 1;
hold = indxfrec_t;
indxfrec_t = indxfrec_t[i + 1];
indxfrec_t[i + 1] = hold;
}
}
if (!swap)
break;
}
for (i = 0; i < index_c; i++)
printf("\n%s\t%ld", indxfrec_t.partid, indxfrec_t.recoffset);
}