Merge sort doubt

https://hack.codingblocks.com/contests/c/457/395
http://ide.codingblocks.com/#/s/20621

Despite of getting right output i get wrong answer.
Please modify it.

#include

using namespace std;

void Merge(int *a, int low, int high, int mid)
{
int i, j, k, temp[high-low+1];
i = low;
k = 0;
j = mid + 1;

while (i <= mid && j <= high)
{
	if (a[i] < a[j])
	{
		temp[k] = a[i];
		k++;
		i++;
	}
	else
	{
		temp[k] = a[j];
		k++;
		j++;
	}
}
while (i <= mid)
{
	temp[k] = a[i];
	k++;
	i++;
}
while (j <= high)
{
	temp[k] = a[j];
	k++;
	j++;
}
for (i = low; i <= high; i++)
{
	a[i] = temp[i-low];
}

}

void MergeSort(int *a, int low, int high)
{
int mid;
if (low < high)
{
mid=(low+high)/2;

	MergeSort(a, low, mid);
	MergeSort(a, mid+1, high);

	Merge(a, low, high, mid);
}

}

int main()
{
int n, i;

cin>>n;

int arr[n];
for(i = 0; i < n; i++)
	cin>>arr[i];

MergeSort(arr, 0, n-1);
for(int i=0;i<n;i++)
    cout<<arr[i]<<" ";


return 0;

}

You haven’t outputed the array. That was the only issue. MergeSort works fine.