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 / anil sai krishna

#include<stdio.h>
main()
{
char a[15],b[15];
int i,l=0,m;
printf("enter the two strings");
scanf("%s%s",a,b);
for(i=0;a[i]=b[i];i++)
{
l++;
}
for(i=0;a[i]!='\0';i++)
{
m++;
}
if(l==m)
{
printf("strings are equal");
}
else
{
printf("not equal");
}
}

Is This Answer Correct ?    7 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the use of linkage in c language?

1067


How to write a program for machine which is connected with server for that server automatically wants to catch the time for user of that machine?

2102


Can you add pointers together? Why would you?

1130


Can you please compare array with pointer?

1096


What is time complexity c?

1001


Differentiate between declaring a variable and defining a variable?

1050


Can math operations be performed on a void pointer?

1055


Can you write the function prototype, definition and mention the other requirements.

1141


What is restrict keyword in c?

1117


Is c is a procedural language?

1100


Is c procedural or functional?

1040


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

1283


Explain is it valid to address one element beyond the end of an array?

1222


What are the properties of union in c?

1055


What is meant by type specifiers?

1139