To find minimum and maximum value from a given array using divide and conquer algorithm

Solution for To find minimum and maximum value from a given array using divide and conquer algorithm
is Given Below:

#include<stdio.h>
static int min,max=0,arrr[100],mid,n;
minmax(int arr[],int low,int high)
{int i;
    if(high-low==1)//for n==2
    {
        if(arr[low]<arr[high])
        {
        min=arr[low];
        max=arr[high];
        arrr[0]=min;
        arrr[1]=max;
        }
        else
        {
            min=arr[high];
            max=arr[low];
            arrr[0]=min;
            arrr[1]=max;
        }
        return 0;
    }
    if(n==1)//n==1
    {
        arrr[0]=arr[high];
        arrr[1]=arr[high];
        return 0;
    }
    mid=low+high/2;
    if(high-low>1)
    {
        mid=low+high/2;
        minmax(arr,low,mid);
        minmax(arr,mid+1,high);
       
    }
}
int main()
{
    int i,j,sum=0,low,high;
    printf("Enter the number of elements: ");
    scanf("%d",&n);
    int arr[n];
    for(i=0;i<n;i++)
    {
        printf("Enter the element %d: ",i);
        scanf("%d",&arr[i]);
    } 
    low=0;//starting value of array
    high=n-1;//final value 
    minmax(arr,low,high);
    printf("nnMinimum element %d nnMaximum element %d ",arrr[0],arrr[1]);
    
}

I’m getting the right answers for the first two cases i.e, when n equals 1 and n equals 2. But for the third case when n is greater than 2,I’m getting the first two values of the input as minimum and maximum. The arrr is the output array that stores the minimum and the maximum value.