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 FIFO?
What are the differences between new and malloc in C?
Q.1 write aprogram to stack using linklist o insert 40 items? Q.2 write a program to implement circular queue with help of linklist?
Explain what is wrong with this program statement? Void = 10;
What is typedef?
int i=3; this declaration tells the C compiler to a) reserve space in memory to hold the integer value b) associate the name i with this memory location c) store the value 3 at this location d) all the above
How can you increase the size of a dynamically allocated array?
can any one please explain, how can i access hard disk(physical address)? it is possible by the use of far,near or huge pointer? if yes then please explain......
Explain what is a const pointer?
What are keywords in c with examples?
How is a macro different from a function?
Explain what will be the outcome of the following conditional statement if the value of variable s is 10?
How can I remove the trailing spaces from a string?
How do I use void main?
Explain how can I convert a string to a number?