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

#include<stdio.h>
#include<conio.h>
void main()
{
char name1[20],name[20];
int i,j,c=0;
clrscr();
printf("enter two strings");
scanf("%s%s",name1,name);
for(i=0,j=0;name1[i]!='\0'||name[j]!='\0';i++,j++)
{
if(name1[i]!=name[j])
{
c++;
}
}
if(c==0)
printf("equal strings");
else
printf("not equal strings");
}

Is This Answer Correct ?    10 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is return in c programming?

1021


C program execution always begins with a) #include b) comment (/*-------*/) c) main() d) declaration instructions

1105


What are the application of void data type in c?

1231


Why is it usually a bad idea to use gets()? Suggest a workaround.

1869


Hi how many types of software editions are there and their difference (like home editions, enterprise, standard etc) can u please help me

1992


What is hashing in c language?

1421


List the difference between a "copy constructor" and a "assignment operator"?

1067


How many types of sorting are there in c?

1111


What is pointer in c?

1249


Is r written in c?

1189


What is main () in c?

1117


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

1176


What are the modifiers available in c programming language?

1279


Do string constants represent numerical values?

1448


What is realloc in c?

1166