Subsegment Divisibility Problem Code: SEGDIV

#include <stdio.h>

int main(void) {
int t;
scanf("%d",&t);
while(t–){
int n;
scanf("%d",&n);
int a[n];
for(int i=0;i<n;i++){
if(i%2==0){
a[i]=0;
}
else{
a[i]=1;
}
}
for(int j=0;j<n;j++){
printf("%d",a[j]);
}
printf("\n");
}
return 0;
}

this is my code for problem SEGDIV whats wrong in it?