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

write a function to find whether a string is palindrome or not and how many palindrome this string..

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

write a function to find whether a string is palindrome or not and how many palindrome this string..

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

More C Interview Questions

int i=~0; uint j=(uint)i; j++; printf(“%d”,j);

which of the function operator cannot be over loaded a) <= b)?: c)== d)*

FILE PROGRAMMING

1,4,8,13,21,30,36,45,54,63,73,?,?.

difference between memcpy and strcpy

wht is the difference between KPO and BPO ?

21. #define square(x) x*x main() { int i; i = 64/square(4); printf("%d",i); }

What are volatile variables?

int j =15,i; for (i=1; 1<5; ++i) {printf ("%d%d ",j,i); j = j-3; }

program to find a smallest number in an array

Go through the following code sinippet char a; a="Hello Orcale Test"; will this compile?

Define function ?Explain about arguments?

Categories
• C (2414)
• C++ (1158)
• VC++ (352)
• Delphi (512)
• Python (58)
• PHP Related (780)
• Programming Languages AllOther (706)