Cpp merge sort recursion

getting a run error is there any tricks during these types of constraints or i am making some mistake

I have edited your code… Try to submit it now.

is there any speed difference in doing
temp[k++] = a[i++]; and temp[k] = a[i]; k++; i++;

Yes… there is a speed difference for large input values…