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
What is include directive in c?
What is meant by type specifiers?
1) There is a singing competition for children going to be conducted at a local club. Parents have been asked to arrive at least an hour before and register their children’s names with the Program Manager. Whenever a participant registers, the Program Manager has to position the name of the person in a list in alphabet order. Write a program to help the Program Manager do this by placing the name in the right place each time the Program Manger enters a name. 2) the Event Manager has to send participants to the stage to perform in the order in which they registered. Write a program that will help the Event Manager know who to call to the stage to perform. The Logic should be in Data Structures
What are dangling pointers in c?
What is preprocessor with example?
Do you have any idea how to compare array with pointer in c?
What extern c means?
Explain how to reverse singly link list.
What are the advantages of the functions?
Using functions, write a program that multiplies two arrays. Use the following functions: - Function ReadArray - Function MultiplyArrays - Function DisplayArrays
program to convert a integer to string in c language'
What’s the special use of UNIONS?
How can I pad a string to a known length?
What is switch in c?
Difference between pass by reference and pass by value?