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
Is it possible to have a function as a parameter in another function?
What is scope and lifetime of a variable in c?
What is an example of structure?
hi... can anyone help me to make a two-dimensinal arrays in finding the sum of two elements plzzz. thnx a lot...
Explain what is meant by 'bit masking'?
Which header file is essential for using strcmp function?
What is the difference between #include and #include 'file' ?
Do you know the difference between malloc() and calloc() function?
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
What is use of pointer?
What is c mainly used for?
What happens if you free a pointer twice?
C program execution always begins with a) #include b) comment (/*-------*/) c) main() d) declaration instructions
What are the different file extensions involved when programming in C?
Explain is it better to bitshift a value than to multiply by 2?