Mergesort array of int using pointers?

At main, if you add a printf("*** n=%d\n", n) before each call to print, you will notice that, before the second call, the output is n=61. That is, you are sorting the array well, but by the time you print it a second time, you print 61 numbers. You can notice as well that 61 is the biggest number in the array, and that n is defined just after arr, so n and arr will be in consecutive memory addresses in the stack.

I think n is being overwritten during the mergesoft function call. Effectively, the overwritting happens when you call mergesoft with &arrn. The last element of the array has the index n-1.

The nth index actually corresponds to the n variable. Change the call to: mergesort(arr,&arr0,&arrn-1).

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions