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

Answer Posted / ravinder singh rawat

#include<conio.h>
#include<stdio.h>
void main()
{ char *a,*count,s[11];
int i ;
printf("\n:enter string for Palindrome test\t");
scanf("%s",&s);
i= strlen(s);
a=(char *)malloc(i*sizeof(char));
a=&s[0];
count=&s[i-1];
while((*(a++)==*(count--)) && i>=1)
{ i--; }
if(i==0) { printf("\n%s is a palin",s);}
else { printf("\n%s is not palin",s);}
getch();
}

Is This Answer Correct ?    39 Yes 7 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Define Spanning-Tree Protocol (STP)

642


Explain what is the benefit of using const for declaring constants?

613


how do you write a function that takes a variable number of arguments? What is the prototype of printf () function?

1494


Explain the red-black trees?

605


How can you invoke another program from within a C program?

615






given post order,in order construct the corresponding binary tree

2321


What is volatile variable in c with example?

584


what type of questions arrive in interview over c programming?

1553


What is a pointer on a pointer in c programming language?

621


Using functions, write a program that multiplies two arrays. Use the following functions: - Function ReadArray - Function MultiplyArrays - Function DisplayArrays

1893


What are the __date__ and __time__ preprocessor commands?

570


p*=(++q)++*--p when p=q=1 while(q<=6)

1266


What is derived datatype in c?

630


What are data types in c language?

581


What is the explanation for prototype function in c?

567