write a function to find whether a string is palindrome or
not and how many palindrome this string contain?
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / 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 |
What does nil mean in c?
What is pointers in c?
What are near, far and huge pointers?
0 Answers Hexaware, Thomson Reuters, Virtusa,
Expand the following LKB BKL FFG
Can the sizeof operator be used to tell the size of an array passed to a function?
What is the use of keyword VOLATILE in C?
Write code for initializing one dimentional and two dimentional array in a C Program?
5 Answers Deshaw, Edutech, GMD,
What does main () mean in c?
Who developed c language?
What is the difference between memcpy and memmove?
what is software?
# define x=1+4; main() { int x; printf("%d%d",x/2,x/4); }