Error :stack terminated. howto remove the error

#include
#include
#include
using namespace std;
bool compare(char s1[],char s2[])
{
char XY[30],YX[30];
strcpy(XY,s1);
strcpy(YX,s2);
strcat(XY,s2);
strcat(YX,s1);
cout<<XY<<" "<<YX<<endl;
return(strcmp(XY,YX)>0)?1:0;
}
void print_largest(char* *ch,int n)
{
sort(ch,ch+n,compare);
for(int i=0;ch[i]!=NULL;i++)
{
cout<<ch[i];
}

}
int main()
{
int test_cases;
cin>>test_cases;
while(test_cases–)
{
int n;
cin>>n;
cin.ignore();
char *ch[n+1];
char str[30];
cin.getline(str,30);
ch[0]=strtok(str," “);
int i=1;
while(ch[i]!=NULL)
{
ch[i++]=strtok(NULL,” ");
}

	print_largest(ch,n);
}

}

hey @Nidhi_Alipuria, can you please share your code with online ide (https://ide.codingblocks.com/) here it is not getting paste correctly.