Help me where I am wrong. Why I don't get a sorted array as my output.
#include<iostream>
using namespace std;
void mergalgo(int arr[], int start, int mid , int end){
    int resultant[5] {};
    int l=0;
    int k= mid+1;
    while(start<mid && k <end){
        if (arr[start]> arr[k]){
            resultant[l++] = arr[k++];
        }
        else{
            resultant[l++]= arr[start++];
        }
    }
    while(start<mid){
        resultant[l++]= arr[k++];
    }
    while(k<end){
        resultant[l++]= arr[k++];
    }
    for(int s=0; s<=end ;s++){
        arr[s]= resultant[s];
    }
}
void mergesort(int arr[], int start , int end){
    //base condition
    if(start<=end){
        return;
    }
    else{
        int mid= (start + end)/2;
        mergesort(arr, start, mid);
        mergesort(arr,mid+1,end);
        
        // merge algo
        mergalgo(arr, start, mid, end);
    }
}
int main(){
    int arr[5] {12,4,5,2,7};
    int start=0;
    int end=4;
    mergesort(arr,start,end);
    //sortd array
    for(int i= 0; i<=4; i++){
        cout<< arr[i]<< " "<< endl;
    }
}
Help me where i am wrong. I am new in C++ so plz do not try to use vectors plz use normal pointer so that i can understand it better.
And also help me on my test cases.. is it right or not because as i already told that .. I am new in programming so do not know that much clearly about all test cases..
 
     
    