what is problem with this code .Please expain?

#include<stdio.h>
#include<stdlib.h>
int main()
{
int t,m,n,i,j,k,x,c1[100],c2[1000];
int mark[1001],a=0,b=0,y;
scanf("%d", &t);

for(i=0;i<t;i++)
{
    scanf("%d", &n);
    scanf("%d", &m);
    for(x=0;x<=n;x++)
        mark[x]=0;
    y=x=m;
    a=b=-1;

    while(m--)
    {
        scanf("%d", &k);
        mark[k]=-1;
    }

    for(j=1;j<=n;j++)
    {
        if(mark[j]!=-1)
        {
          c1[++a]=j;
          //printf("%d****\n",c1[a]);
          j++;
          while((mark[j]==-1)&&(j<=n))
          {
            j++;
          }
          if(j<=n&&mark[j]!=-1)
          c2[++b]=j;
          //printf("%d@@@@\n",c2[b]);
        }
    }

            for(x=0;x<=a;x++)
            {
                printf("%d ",c1[x]);
                c1[x]=0;
            }
    printf("\n");

            for(x=0;x<=b;x++)
            {
                printf("%d ",c2[x]);
                c2[x]=0;
            }
    printf("\n");

}

}

The problem is, that you didn’t describe what you want to achieve…

5 Likes