How to check whether string is a palindrome, WITHOUT USING
STRING FUNCTIONS?
Answer Posted / ramu gurram
#include<stdio.h>
void main()
{
char str[10]="liril";
int i,l,count=1;
printf("first find the string length as follow\n");
printf("\n\n");
for(l=0;str[l]!='\0';l++)
{
}
printf("length of the string %s is %d\n",str,l);
printf("\n\n");
for(i=0,l=l-1;l>=0;l--,i++)
{
if(str[i]!=str[l])
{
count++;
break;
}
}
if(count==1)
printf("given string is palindrom");
else
printf("given string is not palindrom");
}
| Is This Answer Correct ? | 20 Yes | 4 No |
Post New Answer View All Answers
What are the advantages of c preprocessor?
What are the advantages of using Unions?
How can I sort a linked list?
When is the “void” keyword used in a function?
What is the value of h?
what are bit fields? What is the use of bit fields in a structure declaration?
How can I remove the trailing spaces from a string?
What are data structures in c and how to use them?
What is #define in c?
How many types of sorting are there in c?
What is the use of define in c?
What is putchar() function?
Can we add pointers together?
What does s c mean in text?
How would you rename a function in C?