write a function to find whether a string is palindrome or
not and how many palindrome this string contain?

Answers were Sorted based on User's Feedback



write a function to find whether a string is palindrome or not and how many palindrome this string..

Answer / nm

bool palindrome(char *str){
char *ptr1 = str;
char *ptr2 = str + strlen(str) - 1;

while(ptr1 < ptr2){
if(*ptr1 != *ptr2)
return false;
ptr1++;
ptr2--;
}

return true;

}

Is This Answer Correct ?    30 Yes 29 No

write a function to find whether a string is palindrome or not and how many palindrome this string..

Answer / nadeem

bool palindrome(char *str){
char *ptr1 = str;
char *ptr2 = str + strlen(str) - 1;

while(ptr1 < ptr2){
if(*ptr1++!= *ptr2--)
return false;// not palindrome

}

return true;//palindrome


}

Is This Answer Correct ?    3 Yes 6 No

Post New Answer

More C Interview Questions

What is the use of function overloading in C?

0 Answers   Ittiam Systems,


What is keyword with example?

0 Answers  


a=10;b= 5;c=3;d=3; if(a printf(%d %d %d %d a,b,c,d) else printf("%d %d %d %d a,b,c,d);

0 Answers   Wilco,


What is unsigned int in c?

0 Answers  


Explain #pragma statements.

0 Answers  


WAP to convert text into its ASCII Code and also write a function to decode the text given?

2 Answers  


write a c program to find largest of three numbers using simple if only for one time.

1 Answers  


program to print circle structure

1 Answers  


can we write a c program with out using main

3 Answers  


What are advantages and disadvantages of recursive calling ?

12 Answers   College School Exams Tests, Evolving Systems, HP, Jyoti Ltd, Sage, Wipro,


Fifty minutes ago if it was four times as many mints past 3 o clock. how many minutes is it to six o'clock n how....?????

3 Answers   TCS,


Total of how many functions are available in c?

3 Answers  


Categories