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
What is the difference between constant pointer and constant variable?
How can I write a function analogous to scanf?
What are 'near' and 'far' pointers?
PROGRAM TO WRITE CONTENTS OF 1 FILE IN REVERSE TO ANOTHER FILE,PROGRAM TO COPY 1 FILE TO ANOTHER BY SPECIFYING FILE NAMES AS COMMAND LINE
What does %c do in c?
The % symbol has a special use in a printf statement. How would you place this character as part of the output on the screen?
How can you increase the allowable number of simultaneously open files?
What are the different types of control structures?
How can variables be characterized?
What is volatile, register definition in C
What is variable declaration and definition in c?
What is the ANSI C Standard?
What are # preprocessor operator in c?
Which is an example of a structural homology?
What is the use of in c?