hey guys, i programmed a bubble sort function in C and it doesnt seem to be sorting properly. Ive searched the forums and have seen similar posts and tried them but they dont work. :(
Hoping someone could look over it to see if the concept/sytax is right.
typedef struct
{
char artist[40];
char title[60];
int rating;
} song;
void song_by_title(song oneSong[99], int size)
{
song temp1;
int i,j = 0;
int s = 0;
for(i = 0; i < size; i++)
{
for(j = 0; j <= size - 1; j++)
{
s = strcmp(oneSong[j].title, oneSong[j + 1].title);
if(s < 0)
{
temp1 = oneSong[j + 1];
oneSong[j + 1] = oneSong[j];
oneSong[j] = temp1;
}
}
}
}
thank you in advanced
spencer