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

What are enumerated types?

1197


What is a char c?

1043


Which is better oop or procedural?

1072


What is calloc malloc realloc in c?

1062


Is it acceptable to declare/define a variable in a c header?

1127


Is there anything like an ifdef for typedefs?

1154


What is wild pointer in c?

1079


The statement, int(*x[]) () what does in indicate?

1151


Explain what are bus errors, memory faults, and core dumps?

1283


What are header files in c programming?

1137


What are the rules for the identifier?

1171


what does static variable mean?

1115


Explain the use of 'auto' keyword

1125


Write a program to know whether the input number is an armstrong number.

1128


How can I read data from data files with particular formats?

1048