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 is sizeof array?
Is linux written in c?
Why use int main instead of void main?
What is #ifdef ? What is its application?
Why can’t constant values be used to define an array’s initial size?
What is pragma c?
What is the use of static variable in c?
Write a program to check armstrong number in c?
When should a far pointer be used?
What is difference between union and structure in c?
using for loop sum 2 number of any 4 digit number in c language
Whats s or c mean?
Write an efficient algo and C code to shuffle a pack of cards.. this one was a feedback process until we came up with one with no extra storage.
Explain how can I open a file so that other programs can update it at the same time?
How pointer is different from array?