title: Find all possible palindromes in a string using C
body: <p>I have written a program to find all the possible palindromes in the string. The code is below</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  #include&lt;conio.h&gt;
  #include&lt;string.h&gt;
  void main()
  {
    clrscr();
    char *ptr1;
    char str[100];
    printf("enter the string with even length\n");
    gets(str);
    int n;
    int i=strlen(str);
    if(i%2==0)
    {
      for(int n=0;n&lt;=strlen(str);n++)
      {
        for(int k=1;k&lt;=strlen(str);k++)
        {
          int m=0;
          int j=0;
          ptr1=str;
          while(*ptr1!='\0')
          {
            ptr1+;
            j++;
            m++;
          }
          j=j-k;
          for(i=n;i&lt;m/2;i++,j--)
          {
            if(str[i]!=str[j])
            {
              break;
            }
          }
          if(j&lt;=i)
            printf("String is a palindrome\n");
          else
            printf("String is not a palindrome\n");
        }
      }
    }
    else
    {
      printf("String is of odd length");
    }
    getch();
  }
  </code></pre>
  
  <p>But the number of print statements I am getting is more than what it needs to display. Can anyone help me out with the code and tell me where have i gone wrong with this.</p>