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 standard functions are available to manipulate strings?
how to swap 2 numbers in a single statement?
Write a program to swap two numbers without using the third variable?
i=10,j=20 j=i,j?(i,j)?i:j:j print i,j
What are pointers in C? Give an example where to illustrate their significance.
Here is a good puzzle: how do you write a program which produces its own source code as output?
What is the difference between pure virtual function and virtual function?
Table of Sudoku n*n
Is an array parameter is always "by reference" ?
a<<1 is equivalent to a) multiplying by 2 b) dividing by 2 c) adding 2 d)none of the above
#include<stdio.h> int main(){ int a[]={1,2,3,5,1}; int *ptr=a+4; int y=ptr-a; printf("%d",y); }
hi friends how r u as soon in satyam my interview is start but i m very confusued ta wat i do plz help me frndz wat can i do plz tell me some question and answers related with "C" which r asked in the interview .
0 Answers Aegis, CDAC, Infosys,