## hwoarang69 11

i need help with merge sort.

``````struct List_A
{
int data;
struct List_A *next;
};

void merge_sort(struct List_A *);

int main(void)
{
....lets say i have a list build --- (list_A = 4,3,2,5)
merge_sort(List_A);
}

{
struct List_A *cur_one;
struct List_A *cur_two;

{
printf("emptyy list");
}
else
{
while((cur_two != NULL) && (cur_two->next != NULL))
{
cur_two = cur_two->next;
}
return merge(merge_sort(cur_one),merge_sort(cur_two));
}
}

struct List_A *merge (struct list_A *cur_one, struct List_A *cur_two)
{
struct List_A *cur_three;

if(cur_one == NULL)
{
return cur_two;
}
if(cur_two == NULL)
{
return cur_one;
}
if(cur_one->next < cur_two->age)
{
cur_three = cur_two;
cur_three->next = merge(cur_one->next, cur_two);
}
else
{
cur_three = cur_two;
cur_three->next = merge(cur_one,cur_two->next);
}
return cur_three;
}
``````

## Ancient Dragon 5,243

You need to tell us about the problems you are having. Would you take your car to a repair shop and tell the people "my car is broke, please fix it". Of course not, you have to explain as best you can what's wrong with your car. Same here. We can't help you if you won't let us.

## hwoarang69 11

what do you mean "tell us about the problem"? it just a merge sort as i say to top. if you had read my whole post you would have understand that its a linked list and each node have one data inside. the data contain 4,3,3,5. and iam trying to sort this. but for some reason its not sorting the numbers.

## Ancient Dragon 5,243

I tried to compile the code you posted but it contains lots of errors. What compiler are you using? If yours doesn't produce errors then you either need a different compiler or set compiler to a higher warnig level. For example, line 40 the first parameter to merge() is merge_sort() but merge_sort() has a void return value so it will not return anything.

You have to fix all those compile errors before you can tell whether or not the code will work.