Write a program to compare two strings without using the
strcmp() function
Answer Posted / navy
#include<stdio.h>
#include<conio.h>
void main()
{
char s1[20];
int i, j, len=0, flag=0;
printf("\nEnter any string: ");
gets(s1);
for (i=0; s1[i]!='\0'; i++)
len++;
i = 0;
j = len-1;
while (i < len)
{
if (s1[i] != s1[j])
{
flag = 1;
break;
}
i++;
j--;
}
if (flag == 0)
printf("\nString is palindrome");
else
printf("\nString is not palindrome");
getch();
}
| Is This Answer Correct ? | 4 Yes | 1 No |
Post New Answer View All Answers
How many keywords are there in c?
How can you find out how much memory is available?
What is type qualifiers?
Is c# a good language?
What is build process in c?
What is equivalent to ++i+++j?
write a program to reverse a every alternetive words in a string in a place. EX: Input is "this is the line of text" Output should be "shit is eht line fo text" Please any one tell me code for that.
What is a struct c#?
How can you determine the maximum value that a numeric variable can hold?
Describe how arrays can be passed to a user defined function
number of times a digit is present in a number
What is c value paradox explain?
What is the role of this pointer?
How can I determine whether a machines byte order is big-endian or little-endian?
How can I find out if there are characters available for reading?