I am trying to bubble sort the LastName property (under a struct StudentRecord, hence the names) of an array using bubble sort. But I am having trouble doing so.
I am receiving the error (I'm using MinGW to compile):
Invalid array assignment
Here is my code:
void option2 (StudentRecord student[], int n)
{
int pass = 1;
bool done = false;
StudentRecord temp;
while (!done && pass <= n-1)
{
done = true;
for (int i = n-1; i >= pass; i--)
{
if (student[i].lastName < student[i-1].lastName)
{
temp.lastName = student[i].lastName;
student[i].lastName = student[i-1].lastName;
student[i-1].lastName = temp.lastName;
done = false;
}
}
pass++;
}
}
lastName?