title: Manually count characters for a palindrome
body: <p>I currently have a program to detect if a string entered is a palindrome or not. I want to avoid using the strlen method.</p>
  
  <pre><code>    int main ()
      {
      char string[80];
      bool Beginning;
  
  Beginning = true;
  
  while (Beginning)
      {
      cout &lt;&lt; "\nEnter a string\n" &lt;&lt; endl;
          cin.getline(string, 80);
              cout &lt;&lt; "\nYou entered: ";
                  printf(string, 80);
                      cout &lt;&lt; endl;
      if('E' == string[0])  
          {
          if('N' == string [1]) 
              {
              if('D' == string[2])
                  break;
              }
           }
  
      int len=strlen(string);   //avoid this method
  
      bool flag = true;
  
  for (int c=0; string[c]; c++)
  {
      if (flag)
      {
      if(string[c] != string[len-c-1])
              {
              flag = false;
              }
      }
          else
              {
              break;
              }
      }
  
      if (flag)
      {
          printf ("\nThis is a Palindrome\n");
              Beginning = true;
              continue;
      }
  else 
      {
      printf("\nThis is not a palindrome\n");
          Beginning = true;
              continue;
      }
  cin.get();
  
      }
  }
  </code></pre>
  
  <p>I have tried manual counting with the following:</p>
  
  <pre><code>while (string[c] &lt; '\0') {
  c++;
  int len = string[c];
  }
  </code></pre>
  
  <p>The above messes up the programs ability to accurately determine if a string is a palindrome or not, it will say both of them are not, or are. </p>