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
Define Spanning-Tree Protocol (STP)
Explain what is the benefit of using const for declaring constants?
how do you write a function that takes a variable number of arguments? What is the prototype of printf () function?
Explain the red-black trees?
How can you invoke another program from within a C program?
given post order,in order construct the corresponding binary tree
What is volatile variable in c with example?
what type of questions arrive in interview over c programming?
What is a pointer on a pointer in c programming language?
Using functions, write a program that multiplies two arrays. Use the following functions: - Function ReadArray - Function MultiplyArrays - Function DisplayArrays
What are the __date__ and __time__ preprocessor commands?
p*=(++q)++*--p when p=q=1 while(q<=6)
What is derived datatype in c?
What are data types in c language?
What is the explanation for prototype function in c?