Headlines
Loading...
C Program for length of string without using in-built and check for palindrome

C Program for length of string without using in-built and check for palindrome

C program to find the length of a given string without using in-built
function. Also check for palindrome.

#include<stdio .h="">
#include<conio .h="">
void main()
{
 int m,n,i,j,l;
 char a[50],*p;
 clrscr();
 printf("Enter String to check palindrome or not\n");
 gets(a);
 p=a;l=0;
 while(*p!='\0')
 {
  l++;
  p++;
 }
 p--;
 printf("\nLength Of String Is == %d\n",l);
 for(i=0;i&lt;=l/2;i++,p--)
 {
  if(a[i]!=*p)
  {
   printf("\n\nString is not Palindrome");
   break;
  }

 }
 if(a[i]==*p)
 printf("\n\nString Is Palindrome");
 getch();
}
/*Output
Enter String to check palindrome or not
123321

Length Of String Is == 6


String Is Palindrome
*/</conio></stdio>
*** PLEASE checkout the Best deals from for top sites like Amazon, Flipkart etc ***