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

Why is c called a structured programming language?

1290


What is the need of structure in c?

1129


Why doesnt that code work?

1196


When we use void main and int main?

1097


What is the difference between local variable and global variable in c?

1242


Explain what are preprocessor directives?

1078


Is r written in c?

1165


An instruction which is analysed and acted upon by the processor prior to the compiler going its work a) directive b) constructive c) constant d) absolute mode

1102


How can I write functions that take a variable number of arguments?

1143


What is an auto variable in c?

1249


What are the main characteristics of c language describe the structure of ac program?

1223


Apart from dennis ritchie who the other person who contributed in design of c language.

1411


What is multidimensional arrays

1137


What's the total generic pointer type?

1061


Explain the difference between malloc() and calloc() function?

1061