Find string palindrome 10marks

Answer Posted / abhilash meda

#include"string.h"
void main()
{
char *str,*rev;
int i,j;
clrscr();
printf("\nEnter a string:");
scanf("%s",str);
for(i=strlen(str)-1,j=0;i>=0;i--,j++)
rev[j]=str[i];
rev[j]='\0';
if(strcmp(rev,str))
printf("\nThe string is not a palindrome");
else
printf("\nThe string is a palindrome");
getch();
}

Is This Answer Correct ?    1 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain how do you list a file’s date and time?

615


Write a program to generate random numbers in c?

653


Write a code to generate divisors of an integer?

626


What are Macros? What are its advantages and disadvantages?

631


What does the error 'Null Pointer Assignment' mean and what causes this error?

732






in multiple branching construct "default" case is a) optional b) compulsarily c) it is not include in this construct d) none of the above

623


Difference between constant pointer and pointer to a constant.

605


What happens if you free a pointer twice?

596


What is getch () for?

668


What extern c means?

527


How is a null pointer different from a dangling pointer?

550


c program for searching a student details among 10 student details

1646


Explain how many levels deep can include files be nested?

620


how to print electricity bill according to following charges first 100 units -1rs per unit for next 200 units-1.50 rs per unit without using conditions

2715


What is c value paradox explain?

563