RUN ERROR SHOWING,BUT IT IS RUNNING ON VSCODE

#include
using namespace std;

void Merge(int *A,int s,int e)
{
int mid=(s+e)/2;
int i=s;
int j=mid+1;
int k=s;

int temp[100];

while(i<=mid && j<=e)
{
    if(A[i]<A[j])
      temp[k++]=A[i++];
    
    else
      temp[k++]=A[j++];
}
for(;i<=mid;i++)
   temp[k++]=A[i];

for(;j<=e;j++)
   temp[k++]=A[j]; 

for(i=s;i<=e;i++)
   A[i]=temp[i];

}

void Merge_Sort(int *A,int s,int e)
{
if(s==e)
return;

int mid=(s+e)/2;

Merge_Sort(A,s,mid);
Merge_Sort(A,mid+1,e);

Merge(A,s,e);

}

int main()
{
int n;
cin>>n;
int *A=new int[n];

for(int i=0;i<n;i++)
   cin>>A[i];
   
Merge_Sort(A,0,n-1);

for(int i=0;i<n;i++)
   cout<<A[i]<<" ";

}

hi @Mukul-Shane-1247687648773500,
just change size of temp array as array can be of length more than 100

int temp[1000000]; do this else code is good

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.