Insertion sort array of structure by 2 fields
问题 I am making an uno card game with structure of card with fields: struct card { int rank char *color char *action. } I am able to make it sort by color with insertion. I wonder how could I first sort the array of uno card by color, then sort the rank of each color. 回答1: Thanks to Bo Persoson, this is the solution to my question void sort(card *a, int length) { int j; for (int i = 1; i < length; i++) { j = i; while (j > 0 && a[j].color < a[j - 1].color || (a[j].color == a[j - 1].color && a[j]