how t

hello :),
I need help with a function that takes a linked list (that contains a data of type enemy along a pointer that points to the next node)
struct enemy{
int health;
int type;
int region;

};

the function sorts the linked list ascendingly according to their health and then returns the new linked list
my first idea was to create a dynamic array of size n(number of nodes) and of type enemy.
then fill it with the data from the linked list.
then proceed to destroy the linked list and sort the array data according to health and refill the linked list what do you think about that and is there a better way of making the list?
thanks
Topic archived. No new replies allowed.