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

#include <stdio.h>
#include <string.h>
int main()
{
char a[10];
char b[10];
int check = 0;
gets(a);
gets(b);
if (strlen(a)!=strlen(b)) {
printf("Strings don't match!");
} else {
for(int i=0, j=0; a[i] != '' || b[i] != ''; i++, j++) {
if(a[i] == b[i]) {
check = 0;
} else {
check ++;
break;
}
}
if (check == 0) printf("Strings match!");
else printf("Strings don't match");
}
return 0;
}

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain what math functions are available for integers? For floating point?

1114


What is clrscr in c?

1137


What does *p++ do? What does it point to?

1065


What is the use of typedef in structure in c?

972


Hai what is the different types of versions and their differences

1944


What is #define?

1115


Write an algorithm for implementing insertion and deletion operations in a singly linked list using arrays ?

3520


c program to compute AREA under integral

2405


Why do we use null pointer?

1067


a program that can input number of records and can view it again the record

1918


write a C program: To recognize date of any format even formats like "feb-02-2003","02-february-2003",mm/dd/yy, dd/mm/yy and display it as mm/dd/yy.

3830


What are file streams?

1020


Which operators cannot be overloaded a) Sizeof b) .* c) :: d) all of the above

1145


Explain how can I convert a string to a number?

1102


What are unions in c?

1030