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 the function of multilevel pointer in c?
C program execution always begins with a) #include b) comment (/*-------*/) c) main() d) declaration instructions
When should the volatile modifier be used?
What are the Advantages of using macro
What is the difference between text files and binary files?
What is Dynamic memory allocation in C? Name the dynamic allocation functions.
I heard that you have to include stdio.h before calling printf. Why?
What is the difference between declaring a variable and defining a variable?
Explain how do you view the path?
Find the second largest element in an array with minimum no of comparisons and give the minimum no of comparisons needed on an array of size N to do the same.
When should we use pointers in a c program?
Write a code to generate divisors of an integer?
What does printf does?
A global variable when referred to in another file is declared as this a) local variable b) external variable c) constant d) pointers
Is null always equal to 0(zero)?