Sorting in Struct -
typedef struct { int list; int deadline; }order; int c1[] = { 300,300,500,500,1000,1000,1000 }; order a[7]; int b, d; a[0].deadline = 500; a[1].deadline = 300; a[2].deadline = 500; a[3].deadline = 300; a[4].deadline = 1000; a[5].deadline = 1000; a[6].deadline = 1000;
i want make sorting in struct according array , sorting result in a[].list.
i want result;
printf("%d\n", a[0].list);//3 printf("%d\n", a[1].list);//1 printf("%d\n", a[2].list);//4 printf("%d\n", a[3].list);//2 printf("%d\n", a[4].list);//5 printf("%d\n", a[5].list);//6 printf("%d\n", a[5].list);//7
i tried buble sorting, there mistake in somewhere.
Comments
Post a Comment