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

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -