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 / bharat prajapati

#include <stdio.h>
#include <string.h>

main()

{

char s1[10],s2[10];
int i,j;
clrscr();

printf("\nEnter first String:");
scanf("%s",s1);

printf("\nEnter second String:");
scanf("%s",s2);

for(i=0;s1[i]!='\0';i++)
{
for(j=0;s2[j]!='\0';j++)
{
if(s1[i] == s2[j])
continue;
}
}
if (i==j)
{
printf("String s1 : %s and s2 : %s are EQUAL \n",s1,s2);
}
else
printf("String s1 : %s and s2 : %s are NOT EQUAL
\n",s1,s2);
getch();

}

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

explain what is a newline escape sequence?

1043


why use functions a) writing functions avoids rewriting the same code over and over b) using functions it becomes easier to write programs and keep track of what they are doing c) a & b d) none of the above

1097


Is it possible to use curly brackets ({}) to enclose single line code in c program?

1261


how many errors in c explain deply

2039


What is the right type to use for boolean values in c? Is there a standard type? Should I use #defines or enums for the true and false values?

996


Explain what are the different file extensions involved when programming in c?

1054


Why is c used in embedded systems?

1065


What are preprocessor directives in c?

1035


Are local variables initialized to zero by default in c?

986


What is the use of in c?

951


How can I ensure that integer arithmetic doesnt overflow?

1086


How many data structures are there in c?

1069


why programs in c are running with out #include? some warnings are display in terminal but we execute the program we get answer why? eg: main() { printf("hello world "); }

1713


What is the difference between fread buffer() and fwrite buffer()?

1110


Explain that why C is procedural?

1087