write program for palindrome
Answer Posted / niruj
/* without using string.h library */
#include<stdio.h>
#include<conio.h>
void main()
{
char *p;
char a[]="malyalam";
char rev[10];
int i;
int len=sizeof(a);
p=a;
do{
p++;
}while(*p!=NULL);
*p='\0';
i=0;
do{
p--;
rev[i]=*p;
i++;
}while(p!=a);
for(i=0;i<=len-2;i++)
{
if(a[i]==rev[i])
{
if(i==len-2)
{
printf("String is Pallindrom");
}
}
else{
printf("String is not pallindrom");
break;
}
}
getch();
}
| Is This Answer Correct ? | 5 Yes | 2 No |
Post New Answer View All Answers
What is array in c++ pdf?
What is expression parser in c++
Is c++ platform dependent?
What is istream and ostream in c++?
What does it mean to declare a destructor as static?
Do you know about latest advancements in C++ ?
What apps are written in c++?
How many types of scopes are there in c++?
When do we run a shell in the unix system? How will you tell which shell you are running?
Define the process of error-handling in case of constructor failure?
Search for: what is pair in c++?
Discussion on error handling of C++ .
What are compilers in c++?
What are the advantages of using const reference arguments in a function?
How can you prevent accessing of the private parts of my class by other programmers (violating encapsulation)?