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

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

Why enum is used in c?

709


code for quick sort?

1825


Explain what is the benefit of using const for declaring constants?

802


Create a registration form application by taking the details like username, address, phone number, email with password and confirm password (should be same as password).Ensure that the password is of 8 characters with only numbers and alphabets. Take such details for 3 users and display the details. While taking input password must appear as “****”.

2945


Why is c called "mother" language?

1070


What type of function is main ()?

817


A character flag or control mechanism that delineates one data item from another a) variable b) constant c) delimiter d) call by reference

861


Write a program that takes a 5 digit number and calculates 2 power that number and prints it(should not use big integers and exponential functions)

6296


illustrate the use of address operator and dereferencing operator with the help of a program guys plzzz help for this question

1849


What is pivot in c?

768


What is a nested loop?

878


What is the difference between pure virtual function and virtual function?

884


What is #ifdef ? What is its application?

862


Why we use stdio h in c?

797


What is a macro?

877