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
How can I remove the leading spaces from a string?
What is structure and union in c?
define string ?
Program to find the sum of digits of a given number until the sum becomes a single digit. (e.g. 12345=>1+2+3+4+5=15=>1+5=6)
given post order,in order construct the corresponding binary tree
how could explain about job profile
Explain how are portions of a program disabled in demo versions?
How can I sort more data than will fit in memory?
What is the difference between test design and test case design?
1) write a program to generate 1st n fibonacci prime numbers using Nested if 2) write a program to generate twin prime numbers from m to n using nested if 3) write a program to check whether a given integer is a strong number or not using nested if 4) Write a program to generate prime factors of a given integer using nested if 5)write a program to generate prime numbers from m to n using nested if 6)write a program to generate perfect numbers from m to n using nested if 7)write a program to generate the pallindromes from m to n using neste if 8)write a program to generate armstrong numbers from m to n using nested if 9)write a program to generate strong numbers from m to n using nested if
What does the characters “r” and “w” mean when writing programs that will make use of files?
What are enums in c?
What should malloc(0) do? Return a null pointer or a pointer to 0 bytes?
I was asked to write a program in c which when executed displays how many no.of clients are connected to the server.
How can I invoke another program or command and trap its output?