i am trying to sort a structure of arrays by catagory. But it doesnt seem to be working, any ideas on where its going wrong?


for (j = 0; j < i - 1; j++)
for (x = i -1; x > j; --x)
if (VideoData[x-1].videocat < VideoData[x].videocat)
{
tmp = VideoData[x-1].videocat;
VideoData[x-1].videocat = VideoData[x].videocat;
VideoData[x].videocat = tmp;
}

for (j = 0; j < i - 1; j++)
printf("%-9.9s %-16.16s %-12.2s %-10s %-14.2f %c\n", VideoData[j].videonumber, VideoData[j].videotitle, VideoData[j].videocert, VideoData[j].videocat, VideoData[j].dailyrental, VideoData[j].available);