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

Why is sprintf unsafe?

620


What is a far pointer in c?

599


Can a program have two main functions?

573


Why do we use int main instead of void main in c?

624


What is an operator?

658






What is the use of typedef in structure in c?

547


please give me some tips for the placement in the TCS.

1634


What is null pointer constant?

596


What is a string?

667


How can type-insensitive macros be created?

702


GIVEN A FLOATING POINT NUMBER HOW IS IT ACTUALLY STORED IN MEMORY ? CAN ANYONE EXPLAIN?? THE 32 BIT REPRESENTATION OF A FLOATING POINT NUMBER ALLOTS: 1 BIT-SIGN 8 BITS-EXPONENT 23 BITS-MANTISSA

1431


What was noalias and what ever happened to it?

592


Explain what are its uses in c programming?

598


Explain b+ tree?

630


Is c programming hard?

577