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
If i have an array 0 to 99 i.e,(Size 100) I place the values 1 to 100 randomly like a[0]=29,a[1]=56 upto array[99].. the values are only between 1 to 100. getting the array values by using scanf.. If i entered one wrong element value line a[56]=108. how can i find it.. and also how to find the missing value in 1 to 100.. and i want to replace the missing values.. any one of them know please post your answer..
How are variables declared in c?
Can I initialize unions?
How do you search data in a data file using random access method?
Why structure is used in c?
what is the difference between class and unio?
Explain how can you check to see whether a symbol is defined?
What is the use of clrscr?
Are pointers really faster than arrays?
Why is struct padding needed?
Is file a keyword in c?
What is meant by realloc()?
Explain how do you list a file’s date and time?
What will be the outcome of the following conditional statement if the value of variable s is 10?
What is character set?