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 / shaiju . a

int str_cmp( const char *str1 , const char *str2)
{


while(*str1 != '\0')
{
if( *str1 == *str2)
{
str1++;
str2++;
}
else
break;
}


return *str1 - *str2;
}

Is This Answer Correct ?    64 Yes 78 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

The __________ attribute is used to announce variables based on definitions of columns in a table?

1252


Is main is user defined function?

1210


What are the different types of endless loops?

1128


can we change the default calling convention in c if yes than how.........?

2592


Why static variable is used in c?

1085


Can you please explain the difference between exit() and _exit() function?

1083


What is a newline escape sequence?

1160


Explain how can I make sure that my program is the only one accessing a file?

1275


What is clrscr in c?

1171


Write a program to use switch statement.

1184


What is line in c preprocessor?

1101


What is the best way to comment out a section of code that contains comments?

1388


count = 0; for (i = 1;i < = 10; i++);count = count + i; Value of count after execution of the above statements will be a) 0 b) 11 c) 55 d) array

1137


about c language

2074


What is wrong with this program statement? void = 10;

1312