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 |
Write a c program to read a positive number and display it in words.? ex: 123=one two three help me....
how to compare two strings without using strcmp() function??
What is dangling pointer in c?
What is the use of pointers in C?
0 Answers Impetus, Motorola, Tavant Technologies, Virtusa,
What is sizeof c?
How are pointers declared in c?
What are extern variables in c?
How would you write qsort?
In which header file is the null macro defined?
What is the right way to use errno?
How to run c Program without using IDE of c. means if program made in notepad.then how to compile by command prompt.
What is register variable in c language?