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

If you know then define #pragma?

1101


What is the method to save data in stack data structure type?

1080


What are the advantages of using new operator as compared to the function malloc ()?

1327


What is merge sort in c?

1043


What is use of bit field?

1288


What are categories used for in c?

1091


Not all reserved words are written in lowercase. TRUE or FALSE?

1228


What is the significance of an algorithm to C programming?

1042


What are the different types of C instructions?

1305


What is difference between scanf and gets?

1262


a way in which a pointer stores the address of a pointer which stores the value of the target value a) reference b) allocation c) multiple indirection d) none

1145


Are comments included during the compilation stage and placed in the EXE file as well?

1077


Do you have any idea about the use of "auto" keyword?

1078


What are the types of type specifiers?

1033


What is getch c?

1293