I have an array of structsi want to compare the field aCode:typedef struct node { int a,b,c,d; } element; ... element array[5];but swap the entire element.Code:if (niz[j].a > niz[j+1].a)

basiccaly doing what excel does, when you sort one column which is asociated with other columns.

i.e.

the problem is, i don't know how to do it with insertion sort. this is my insertion sort which works on a "normal" 1D int array but I need to modify itCode:PRE SORT ========= 20 14 32 13 21 26 19 17 11 POST SORT ========= 13 21 26 19 17 11 20 14 32

Code:void Insertion (int array[], int n) { int i; for (i=0; i < n; i++) { int j, temp = array[i]; for (j = i - 1; j >= 0; j--) { if (array[j] <= v) break; array[j + 1] = array[j]; } array[j + 1] = temp; } }