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

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

how should functions be apportioned among source files?

874


What is the best way to store flag values in a program?

796


What are pointers?

862


what is the height of tree if leaf node is at level 3. please explain

1843


What is difference between class and structure?

841


Explain high-order and low-order bytes.

878


What is a memory leak? How to avoid it?

893


How to throw some light on the b tree?

825


What is meant by initialization and how we initialize a variable?

820


Explain what are preprocessor directives?

829


in any language the sound structure of that language depends on its a) character set, input/output function, its control structures b) character set, library functions, input/output functions its control structures c) character set, library functions, control sturctures d) character set, operators, its control structures

943


What is the size of structure in c?

909


How important is structure in life?

811


What is nested structure?

789


Which header file should you include if you are to develop a function which can accept variable number of arguments?

1063