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 / raghu

#include<stdio.h>
#include<conio.h>
void main()
{
char a[100],b[100];
int i,c;
clrscr();
printf("enter first string");
scanf("%s",&a);
printf("enter second string");
scanf("%s",&b);
for(i=0;a[i]!='\0'&&b[i]!='\0';i++)
{
if(a[i]!=b[i])
{
c=1;
}
}
if(c==1)
{
printf("the strings do not match!");
}
else
{
printf("the strings match!");
}
getch();
}

Is This Answer Correct ?    8 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is difference between stdio h and conio h?

1436


What are the advantages of using linked list for tree construction?

1145


what do the 'c' and 'v' in argc and argv stand for?

1219


What does the file stdio.h contain?

1119


What is the hardest programming language?

1214


What are the uses of a pointer?

1197


What is the difference between c &c++?

1208


What is the use of in c?

1085


Why c is called a middle level language?

1161


What is getch c?

1342


What is the difference between functions abs() and fabs()?

1207


What does 3 mean in texting?

1163


How to check whether string is a palindrome, WITHOUT USING STRING FUNCTIONS?

16918


can we implement multi-threads in c.

1177


Are there namespaces in c?

1187