sorting a member of a structure

Can anyone help me with sorting a member of a structure.
Maybe.
What do you mean?

Is there a member of a struct that needs to be sorted? Then you can use one of the many sorting algorithms explained in depth on the internet.

Do you need to sort a collection of these structs based on a certain member? Again, use one of the many sorting algorithms, but this time you will have to write a short comparison function that will compare this member in two of these structs.
Hello Ganon11,
Thank you for tha reply, I have solved the problem, quite. To answer yur question, I just wan to sort int prev which is located inside the structure customer[100].


1
2
3
4
5
6
7
8
9
10
11
12
struct
	{
	long int cid;
	char fn [20];
	char mi;
	char ln [20];
	char addr[40];
	long int prev;
	long int curr;
	long int cons;
	float bill;
   }customer [100];
Last edited on
Topic archived. No new replies allowed.