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 own function to compare two strings with out using
stringcomparition function?

Answer Posted / ravikiran p sattigeri

/* str_cmp : Comapares the character strings s1 and s2, and
returns negative, zero or positive if s1 is
lexicographically less than, equal to, or greater than s2.
The value is obtained by subtracting the characters at the
first position where s1 and s2 disagree */

/* return < 0 if s1<s2, 0 if s1==s2, >0 if s1>s2 */
int str_cmp (char *s1, char *s2)
{
while(*s1++ == *s2++) {
if (*s1 == '\0')
return 0;
}
return *S1 - *s2;
}

Is This Answer Correct ?    13 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what is uses of .net

1684


What does 3 mean in texting?

1030


What are the types of bitwise operator?

1048


Write a program to swap two numbers without using the third variable?

1016


What is the difference between malloc() and calloc() function in c language?

1029


What is wrong with this initialization?

955


`write a program to display the recomended action depends on a color of trafic light using nested if statments

2075


What is difference between structure and union in c?

925


What are qualifiers and modifiers c?

940


What is the function of volatile in c language?

1071


What is the difference between malloc() and calloc()?

1692


Why is structure important for a child?

1049


What are the features of the c language?

1036


Function calling procedures? and their differences? Why should one go for Call by Reference?

1041


What are the advantages of the functions?

1097