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
How arrays can be passed to a user defined function
What are types of preprocessor in c?
How is a macro different from a function?
why to assign a pointer to null sometimes??how can a pointer we declare get assigned with a garbage value by default???
Differentiate fundamental data types and derived data types in C.
Tell us bitwise shift operators?
How can I generate floating-point random numbers?
Difference between goto, long jmp() and setjmp()?
What is pointers in c?
What is an identifier?
write a program that declares an array of 30 elements named "income" in the main functions. then cal and pass the array to a programmer-defined function named "getIncome" within the "getIncome" function, ask the user for annual income of 30 employees. then calculate and print total income on the screen using the following function: "void getIncome ( ai []);
Why are some ANSI/ISO Standard library routines showing up as undefined, even though I've got an ANSI compiler?
What do you mean by a sequential access file?
What is the difference between exit() and _exit() function?
What are the valid places to have keyword “break”?