Help me in solving DNASTORAGE problem , showing run time error

My issue

include <stdio.h>
include <string.h>
int main(void) {
int t,n,i;
char s[n];
scanf(“%d”,&t);
while(t–){
scanf(“%d”,&n);
scanf(“%s”,s);
for(i=0; i<n; i+=2){
if((s[i]==‘0’) && (s[i+1]==‘0’)){
printf(“A”);
}
if((s[i]==‘0’) && (s[i+1]==‘1’)){
printf(“T”);
}
if((s[i]==‘1’) && (s[i+1]==‘0’)){
printf(“C”);
}
if((s[i]==‘1’) && (s[i+1]==‘1’)){
printf(“G”);
}

    }
    printf("\n");
}
return 0;

}

I have return this code which is correct , but it is displaying as run time error, how to resolve this?

My code

#include <stdio.h>
#include <string.h>
int main(void) {
	int t,n,i;
	char s[n];
	scanf("%d",&t);
	while(t--){
	    scanf("%d",&n);
	    scanf("%s",s);
	    for(i=0; i<n; i+=2){
	        if((s[i]=='0') && (s[i+1]=='0')){
	            printf("A");
	        }
	        if((s[i]=='0') && (s[i+1]=='1')){
	            printf("T");
	        }
	        if((s[i]=='1') && (s[i+1]=='0')){
	            printf("C");
	        }
	        if((s[i]=='1') && (s[i+1]=='1')){
	            printf("G");
	        }
	        
	    }
	    printf("\n");
	}
	return 0;
}


Learning course: Strings using C
Problem Link: CodeChef: Practical coding for everyone

@yaalini
Your problem is resolved .
Have made some changes in your .
Hope u will get it.

#include <stdio.h>
#include <string.h>
int main(void) {
	int t,n,i;
	
	scanf("%d",&t);
	while(t--){
	    scanf("%d",&n);
	    char s[n];
	    scanf("%s",s);
	    for(i=0; i<n-1; i+=2){
	        if((s[i]=='0') && (s[i+1]=='0')){
	            printf("A");
	        }
	        if((s[i]=='0') && (s[i+1]=='1')){
	            printf("T");
	        }
	        if((s[i]=='1') && (s[i+1]=='0')){
	            printf("C");
	        }
	        if((s[i]=='1') && (s[i+1]=='1')){
	            printf("G");
	        }
	        
	    }
	    printf("\n");
	}
	return 0;
}

thanks a lot! got the output , but will you please elaborate what changes have made it stop to undergo a run time error?

@yaalini
character array will get declared inside test loop and the loop will run till n-1.