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 / allen

#include<stdio.h>
#include<conio.h>
void stringcmp(char s1[], char s2[]);
void main()
{
char str1[10],str2[10];

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

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

stringcmp(str1,str2);
}

void stringcmp(char *s1, char *s2)
{
int i,j,c=0;
for(i=0,j=0;s1[i]!='\0'||s2[j]!='\0';i++,j++)
{
if(s1[i]!=s2[j])
{
c++;

}

}
if(c==0)
printf("\nstring match");
else
printf("\nstring does not match");
}

Is This Answer Correct ?    12 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Which is better oop or procedural?

988


program to find out date after adding 31 days to a date in the month of febraury also consider the leap year

3019


Explain can the sizeof operator be used to tell the size of an array passed to a function?

1016


What is the symbol indicated the c-preprocessor?

1166


what does static variable mean?

1050


What is the modulus operator?

1152


What is the explanation for modular programming?

1148


What is a MAC Address?

1005


Explain what is the benefit of using const for declaring constants?

967


What is the -> in c?

955


What is the size of array float a(10)?

1091


why to assign a pointer to null sometimes??how can a pointer we declare get assigned with a garbage value by default???

1913


Explain setjmp()?

1008


Simplify the program segment if X = B then C ← true else C ← false

2960


Write a program to generate the Fibinocci Series

1162