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

Is it possible to have a function as a parameter in another function?

603


What is scope and lifetime of a variable in c?

581


What is an example of structure?

591


hi... can anyone help me to make a two-dimensinal arrays in finding the sum of two elements plzzz. thnx a lot...

1448


Explain what is meant by 'bit masking'?

646






Which header file is essential for using strcmp function?

947


What is the difference between #include and #include 'file' ?

610


Do you know the difference between malloc() and calloc() function?

617


Write a C program to accept a matrix of any size. Find the frequency count of each element in the matrix and positions in which they appear in the matrix

1523


What is use of pointer?

589


What is c mainly used for?

601


What happens if you free a pointer twice?

612


C program execution always begins with a) #include b) comment (/*-------*/) c) main() d) declaration instructions

615


What are the different file extensions involved when programming in C?

764


Explain is it better to bitshift a value than to multiply by 2?

720