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...

program for comparing 2 strings without strcmp()

Answer Posted / bin

Here is a subroutine that does strcpy, returns 0 if both are equal, returns a positive number, if arg1 is higher else returns a negative number


int mystrcmp(char *s1, char *s2)
{
while (*s1 != 0 && *s2 != 0 && *s1 == *s2) {
++s1; ++s2;
}
return (*s1) - (*s2);
}

Is This Answer Correct ?    1 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Write the syntax and purpose of a switch statement in C.

1109


define string ?

1112


What are the basic data types associated with c?

1273


Can you please explain the difference between syntax vs logical error?

1191


Is stack a keyword in c?

1090


What is the acronym for ansi?

1051


What does main () mean in c?

1099


Why is C language being considered a middle level language?

1130


What is a global variable in c?

1013


What is chain pointer in c?

1061


What is extern c used for?

1062


How can I make it pause before closing the program output window?

1043


Which control loop is recommended if you have to execute set of statements for fixed number of times?

1349


What are bitwise shift operators in c programming?

1084


Why are all header files not declared in every c program?

1104