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

How do I read the arrow keys? What about function keys?

821


Write a program to check whether a number is prime or not using c?

782


Explain how many levels deep can include files be nested?

797


In c programming, explain how do you insert quote characters (? And ?) Into the output screen?

969


What are enums in c?

825


What is console in c language?

807


Why do we use null pointer?

772


Explain setjmp()?

814


 write a program that will open the file, count the number of occurences of each word in the the complete works of shakespeare.  You will then tabulate this information in another file.

1929


What is type qualifiers?

848


Explain continue keyword in c

756


What is f'n in math?

804


An arrangement of information in memory in such a way that it can be easily accessed and processed by a programming language a) string b) data structure c) pointers d) array

880


Can we compile a program without main() function?

847


a direct address that identifies a location by means of its displacement from a base address or segment a) absolute address b) relative address c) relative mode d) absolute mode

864