write a own function to compare two strings with out using
stringcomparition function?

Answer Posted / geetha

main()
{
char a[10],b[10];
int i,l2,l1;
printf("Enter two strings");
scanf("%s\n",a);
scanf("%s",b);
l1=strlen(a);
l2=strlen(b);
if(l1==l2)
{
for(i=0;i<l1;i++)
{
if(a[i]==b[i])
continue;
else
printf("no match");
break;
}
}
else
printf("no match");
if(i==11)
printf("both strings are same");
}

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Who is the main contributor in designing the c language after dennis ritchie?

544


write a program that types this pattern: 12345678987654321 12345678 87654321 1234567 7654321 123456 654321 12345 54321 1234 4321 123 321 12 21 1 1

3277


Lists the benefits of c programming language?

591


What is difference between arrays and pointers?

577


What is 1d array in c?

598






What is define c?

568


What is the difference between fread and fwrite function?

634


Do pointers take up memory?

652


What is a null pointer assignment error? What are bus errors, memory faults, and core dumps?

899


Tell me with an example the self-referential structure?

560


What are the application of void data type in c?

693


What is anagram in c?

512


what are enumerations in C

720


Why do we use int main instead of void main in c?

613


How can I use a preprocessorif expression to ?

597