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


Please Help Members By Posting Answers For Below Questions

we need to calculating INCOME TAX for the person. The INCOME TAX is as follows:- First $10000/- of income : 4% tax Next $10000/- of income : 8% tax Next $10000/- of income : 11.5% tax above $10, 00,00/- : 15% tax What is the Solution of this Question ?

1058


‘SAVEPOINT’ and ‘ROLLBACK’ is used in oracle database to secure the data comment. Give suitable examples of each with sql command.

2110


Why n++ execute faster than n+1 ?

2398


How can I check whether a file exists? I want to warn the user if a requested input file is missing.

935


what is recursion in C

860


What are external variables in c?

822


Differentiate between calloc and malloc.

1043


What are the different types of endless loops?

864


Can we assign integer value to char in c?

868


Explain how does free() know explain how much memory to release?

829


What are c identifiers?

878


find the output? void r(int a[],int c, int n) { if(c>n) { a[c]=a[c]+c; r(a,++c,n); r(a,++c,n); } } int main() { int i,a[5]={0}; r(a,0,5); for(i=0;i<5;i++) printf("\n %d",a[i]); getch(); }

2105


What is the difference between strcpy() and memcpy() function in c programming?

881


How do I send escape sequences to control a terminal or other device?

868


Write programs for String Reversal & Palindrome check

829