Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

Explain how can I read and write comma-delimited text?

1177


which of the following shows the correct hierarchy of arithmetic operations in C a) (), **, * or/,+ or - b) (),**,*,/,+,- c) (),**,/,*,+,- d) (),/ or *,- or +

1739


What are compound statements?

1184


What happens if you free a pointer twice?

1087


What is #define?

1123


How can I automatically locate a programs configuration files in the same directory as the executable?

1179


Is a house a mass structure?

1097


Multiply an Integer Number by 2 Without Using Multiplication Operator

772


What is file in c preprocessor?

1157


Explain what are the __date__ and __time__ preprocessor commands?

1131


What is c basic?

1184


How are portions of a program disabled in demo versions?

1298


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?

1266


Can we use visual studio for c?

1103


Why do we use header files in c?

1081