Hey all
Ive written this merge sort code that uses an array of structures that sorts the data according to the name of the student.Im getting a seg fault here..Pls help!
Ive written this merge sort code that uses an array of structures that sorts the data according to the name of the student.Im getting a seg fault here..Pls help!
Welcome to this forum. Please take time and read the "Before posting" tutorial And also edit your thread and use code tags to make your code readable - http://www.cplusplus.com/articles/jEywvCM9/
You also forgot to ask a question. With what do you need help, are you having errors? if yes present the full error codes. Is an output not what it should be? Then what should it be, and what is it currently? Be specific, we cant read minds here.
$ gdb a.out
> run
(input)
Program received signal SIGSEGV, Segmentation fault.
> backtrace
1 2 3 4 5 6 7 8 9 10
void merge_sort (record a[], int low, int high)
{
if (low < high)
{
int m = (low + high) / 2;
merge_sort (a, low, high); //stack overflow, you did not change the parameters.
merge_sort (a, m + 1, high);
merge (a, low, m, high);
}
}