Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

write a program of palindrome(madam=madam) using pointer?

Answer Posted / pradeep raj

int main()
{
char a[20],*p,*q;//p=>front pointer q=>back pointer
int flag=0;
cin >>a;
q=&a[0];
while(*q!='\0')
q++;
q--; // to the last character before null

for(p=&a[0];p!=q ;p++,q--)
{

if(*p==*q)
flag++;
if((q-p)==1)//to avoid even palindrome..
break;

}
if(flag==strlen(a)/2)
cout <<" is palindrome";
else
cout <<"not";
getch();

}

Is This Answer Correct ?    3 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can you please explain the difference between strcpy() and memcpy() function?

1013


What Is The Difference Between Null And Void Pointer?

1155


Explain how can type-insensitive macros be created?

953


What is typedf?

1064


Are the outer parentheses in return statements really optional?

1046


shorting algorithmS

2193


What is context in c?

880


How can you increase the size of a dynamically allocated array?

1129


What are static variables in c?

1026


write a sorting prgm to sort 50 nos and sum them and also remove all the occurrences of 15 and print it?

2075


Is c language still used?

932


Write the Program to reverse a string using pointers.

966


What does *p++ do? What does it point to?

1003


Why does this code crash?

1026


A routine usually part of the operation system that loads a program into memory prior to execution a) linker b) loader c) preprocessor d) compiler

1049