Sigsegv error__clean up problem

Why this code is not returning any value and getting runtime error

#include<stdio.h>
#include<stdlib.h>
#define MAX 1000
int arr[MAX];
int main()
{int i,m,j=1,r[j],n,t,done;
scanf("%d",&t);
while(t>0){
scanf("%d%d",&n,&m);

    for(i=1;i<=m;i++)
    {
        scanf("%d",&done);
        arr[done]=1;
    }

    for(i=1;i<=n;i++)
    {
        if(arr[i]==1)
        {
            continue;
        }


        r[j]=i;

        j++;
    }
    for(i=1;i<=n-m;i++){
            if(i%2!=0)

   printf("%d ",r[i]);}
   printf("\n");
   for(i=1;i<=n-m;i++)
   {
       if(i%2==0)
        printf("%d ",r[i]);
   }

Printf("\n") ;
t–;
}
Return 0;
}

Please either format your code or (better!) link to your submission - the forum software has mangled it and it won’t compile! :slight_smile:

Edit:

I don’t see any Submission from you for any Problems - are you trying to “Run” without Providing “Custom Input”?