I am trying to sort a structure in C. I am using one of the fields of the structure as a sort field. The current problem is it won't compile with the temp field of the sort as an integer and the other field being sorted as a array of the structure.
The error I am getting is
Cannot assign "majorteam" to "int" in function main
Cannot cast from "int" to "majorteam" in function main.
I have both the counters for the sort and the temp field defined as integers.
Here is the code:
for (y=0; y<=9; y++)
for (x=y; x<=9;x++)
if teamone[y].ability > teamone[x].ability)
tempteam = teamone[x];
teamone[x] = teamone[y];
teamone[y] = teampteam;
teamone[y] = tempteam;
then a print statement to print the list by ability.
Any help would be appreciated,