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 / bhagwati lal paliwal(b.l.paliw

ALL PERSON ARE STUPIDS THEY DONT KNOW HERE WAT THE FUNCTION
STRCMP DO IT COMPARE BOTH STRING AND RETURN AN INTEGER
VALUE BUT ALL STUPID ARE COMPARING THE LENGTH OF STRING NOT
CHARACTER
Now the right answer by me follow me............
and tell me if this code work properly on
bl_paliwal77@yahoo.com

#include<stdio.h>
#include<string.h>
int cmpstr(char s1[10], char s2[10]);

int main() {
char arr1[10] = "Nodalo";
char arr2[10] = "nodalo";
printf(" %d", cmpstr(arr1, arr2));

return 0;
}


int cmpstr(char s1[10], char s2[10])
{

int i = strlen(s1);
int k = strlen(s2);
int bigger;

if (i < k) {
bigger = k;
}
else if (i > k) {
bigger = i;
}
else {
bigger = i;
}


for (i = 0; i < bigger; i++) {
if (s1[i] == s2[i])
{
//do nothing if value of both string are equal
}
else {
return (s1[i] - s2[i]);
}
}
return (0);
}

Is This Answer Correct ?    9 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why C language is a procedural language?

1042


Explain how do you determine whether to use a stream function or a low-level function?

1092


Is register a keyword in c?

1048


How do you do dynamic memory allocation in C applications?

1089


What are the advantages of using Unions?

1121


p*=(++q)++*--p when p=q=1 while(q<=6)

1764


Disadvantages of C language.

1109


What is 'bus error'?

1157


What is the general form of #line preprocessor?

1005


What is the meaning of typedef struct in c?

1072


Write a program to print factorial of given number using recursion?

1020


What is the default value of local and global variables in c?

1049


What does %2f mean in c?

1226


Why isn't any of this standardized in c? Any real program has to do some of these things.

1216


What is the difference between strcpy() and memcpy() function in c programming?

1090