The execution resumes from 2 instead of continuing from 1 after completing each cycle. I dont knw why that happens. Please help
int palindrome(int first, int last)
{
int comb=1,i,j,count,fb=0;
j=last;
2-> i=first;
while(i!=last)
{
j--;
if(str[i]==str[j])
{
int m,n;
m=i;
n=j;
while(1)
{
m++;
n--;
if(m>=n)
{
fb=1;
break;
}
if(str[m]!=str[n])
{
fb=0;
break;
}
}
}
if(fb==1)
{
count=palindrome(i,j);
1-> comb=count*comb;
i=j+1;
j=last+1;
fb=0;
}
if(j==i+1)
{
i++;
j=last+1;
}
}
int k=0;
char *array;
len=last-first+1;
comb=(len/2)+1;
i=first;
j=last;
array=(char *)malloc(len);
while(i<=j)
{
*(array+k)=str[i];
k++;
i++;
}
*(array+k)='\0';
printf("\n%s\t %d",array,comb);
return(comb);
}
Use the [code] [/ code] (remove the space after the '/') to list your code in a more readable format.
On the right when you post, there are several format icons. <> is for code, == is for output, ect.