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
Explain how can I convert a number to a string?
Write a Program to find whether the given number or string is palindrome.
What is array within structure?
Declare the structure which contains the following members and write in C list of all students who score more than 75 marks. Roll No, Name, Father Name, Age, City, Marks.
what is the different bitween abap and abap-hr?
pgm to find any error in linklist(in single linklist check whether any node points any of previous nodes instead of next node)
Differentiate fundamental data types and derived data types in C.
What are c identifiers?
Explain what is the difference between functions abs() and fabs()?
What is #line?
How does normalization of huge pointer works?
What is the use of pointers in C?
what do the 'c' and 'v' in argc and argv stand for?
What are identifiers c?
C program to find all possible outcomes of a dice?