write a program of palindrome(madam=madam) using pointer?

Answer Posted / priyanka

#include<stdio.h>
#include<conio.h>
int stpal(char str[50]);
void main()
{
char str[50];
int pal;
clrscr();
printf(“nnt ENTER A STRING…: “);
gets(str);
pal = stpal(str);
if(pal)
printf(“nt THE ENTERED STRING IS A PALINDROME”);
else
printf(“nt THE ENTERED STRING IS NOT A PALINDROME”);
getch();
}
int stpal(char str[50])
{
int i = 0, len = 0, pal = 1;
while(str[len]!=’&#8242;)
len++;
len–;
for(i=0; i<len/2; i++)
{
if(str[i] == str[len-i])
pal = 1;
else
{
pal = 0;
break;
}
}
return pal;
}

Is This Answer Correct ?    2 Yes 11 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

exit () is used to a) exit () terminates the execution of the program itself b) exit () terminates the execution of the loop c) exit () terminates the execution of the block d) none of the above

656


Is register a keyword in c?

631


Why is #define used?

788


What is variable and explain rules to declare variable in c?

549


What are the types of unary operators?

656






How can a process change an environment variable in its caller?

648


i have to apply for the rbi for the post of officers. i need to know abt the entrance questions whether it may be aps or techinical....

1518


How do we open a binary file in Read/Write mode in C?

676


Device an algorithm for weiler-atherton polygon clipping, where the clipping window can be any specified polygon

5462


write a program that reads lines(using getline), converts each line to an integer using atoi, and computes the average of all the numbers read. also compute the standard deviation.

1981


Which is best book for data structures in c?

594


What is an example of structure?

586


Should I learn data structures in c or python?

576


How many keywords (reserve words) are in c?

614


what is use of malloc and calloc?

1380