# Use c how to solve this question-Repeated DNA Sequences

• //My code can run in computer but cant here, what is mean int *outputSize? What need to return.use C

``````char **findRepeatedDnaSequences(char *input, int *outputSize) {
int i,j,k;
int flag=0;
int len=strlen(input);
char res[100];
char s1[10],s2[10],s3[10];
for(i=0;i<len-10;i++)
{
memset(s1,0,sizeof(s1));
strncpy(s1,input+i,10);
s1[10]='\0';
char c1=s1[9];
for(j=i+10;j<len-10;j++)
{
char c2=input[j];
if(c1!=c2)
continue;
memset(s2,0,sizeof(s2));
memset(s3,0,sizeof(s3));
strncpy(s2,input+j,10);
s2[10]='\0';
for(k=0;k<10;k++)
s3[9-k]=s2[k];
s3[10]='\0';
if(strcmp(s1,s3)==0)
{
flag=1;
res[0]='[';
res[1]='"';
strncpy(res+2,s1,10);
res[12]='"';
res[13]=',';
res[14]='"';
strncpy(res+14,s2,10);
res[24]='"';
res[25]=']';
res[26]='\0';
printf("%s\n",res);
}
}
if(flag)
break;
}
return NULL;
}``````

• You'll need to return two things:

1. array of cstring (char **)
2. how many strings in returning array (*outputSize)

• my problem is: if outputSize is ZERO, what about output pointer, is it a NULL pointer? or a pointer to NULL?

• If outputSize is Zero, then return pointer doesn't matter. You can either return a NULL, or, a pointer point to an allocated area. Both work for me.

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.