here why u have taken mid+1 instead of mid
Regarding merge sort
this is how our merge sort is working

follow the numbers in green to trace the flow of program
but if we do mid+1 what is theactual position we get can u tell ?
if take s+e/2 then suppose if there are 5 elements ,then which one will be mid 2 or 3?
mid will be 2 for n=5 coz we take ans in int form here so 5/2 =2 and therefore we need to take 1st array till 2 and then start next from the 3rd element (m+1)
for storing the element to orignal array why we have taken i inside temp we have stored in temp[k] ?
and in main function why u have passed 0 in(a,0,n-1) …
Array is taken from 0 to position n-1 so we passed 0 and n-1
can you elaborate your doubt
can u tell me whats the error .
here is your corrected code:
i have marked the mistakes
if this solves your doubt please mark it as resolved 