Hi,
I created a function that reads elements of an array and arrange them in ascending format. Now I need to somewhat tag their ID to the element wherever their position. Example:
That would be the answer if the IDs are like their value. Eg ID 2 = 90, ID 1 = 50, ID 3 = 95.
I think Thomas is suggesting one array of int to hold the values and one array of char to hold the tags. When you swap items in the value array, you need to swap the corresponding items in the tag array.
Notice that Thomas's and gunnerfunner's solutions work the same way: store both the tag and the value. When you swap values, swap the tags too. The difference is that Thomas stores the data in two arrays and gunnerfunner stores it in an array of structs.