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
How do you determine a file’s attributes?
How many levels of indirection in pointers can you have in a single declaration?
What are the types of pointers?
Explain the use of fflush() function?
What will the code below print when it is executed? int x = 3, y = 4; if (x = 4) y = 5; else y = 2; printf ("x=%d, y=%d ",x,y);
What are the c keywords?
Can true be a variable name in c?
which of the following is not a character constant a) 'thank you' b) 'enter values of p, n ,r' c) '23.56E-o3' d) all of the above
How do you initialize pointer variables?
How can I dynamically allocate arrays?
If a variable is a pointer to a structure, then which operator is used to access data members of the structure through the pointer variable?
Explain the properties of union. What is the size of a union variable
What is a lvalue
What is the best style for code layout in c?
What is I ++ in c programming?