What's wrong with the following cooling pies C program?

#include<stdio.h>
int main()
{
int t,n,j,pie[101],rack[101],small_pie,small_rack,count=0,i,index1,index2;
scanf("%d",&t);
for(j=0;j<t;i++)
{

scanf("%d",&n);
for(i=0;i<n;i++)

{
scanf("%d",&pie[i]);

}

for(i=0;i<n;i++)
{
scanf("%d",&rack[i]);

}
for(j=0;j<n;j++)
{
for(i=0;i<n;i++)
{
small_pie=2000;
small_rack=2000;
if(small_pie>pie[i])

{
small_pie=pie[i];
index1=i;

}

if(small_rack>rack[i])
{

small_rack=rack[i];
index2=i;

}

}

if(small_pie<=small_rack)
{

count++;
pie[index1]=’\0’;
rack[index2]=’\0’;

}
else

{
rack[index2]=’\0’;

}

}

printf("%d\n",count);
}
return 0;

}

Well for starters, You are using j as variable which keep trackes of the no of cases and then you are using it inside that loop again which changes its value. Try to use separate variables for separate tasks and use indentation as a newbee.