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
What is getche() function?
What is logical error?
How do you list files in a directory?
How to write a code for reverse of string without using string functions?
What is page thrashing?
Give me the code of in-order recursive and non-recursive.
What is data structure in c programming?
C language questions for civil engineering
What is assignment operator?
Write the test cases for checking a variable having value in range -10.0 to +10.0?
What is the difference between char array and char pointer?
Explain what is a 'locale'?
Explain the difference between malloc() and calloc() in c?
How can I do graphics in c?
Why header files are used?