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]!=’′)
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
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
Is register a keyword in c?
Why is #define used?
What is variable and explain rules to declare variable in c?
What are the types of unary operators?
How can a process change an environment variable in its caller?
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....
How do we open a binary file in Read/Write mode in C?
Device an algorithm for weiler-atherton polygon clipping, where the clipping window can be any specified polygon
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.
Which is best book for data structures in c?
What is an example of structure?
Should I learn data structures in c or python?
How many keywords (reserve words) are in c?
what is use of malloc and calloc?