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

Answer Posted / sasikumar

main()
{
char s1[10],s2[10];
printf("enter two strings:");
scanf("%s%s",&s1[10],&s2[10]);
compare(s1[10],s2[10]);
getch();
}
compare(char st1[10],char st2[10])
{
int l1,l2,i;
l1=strlen(st1[10]);
l2=strlen(str2[10]);

if(l1==l2)
{
for(i=0;i<l1;i++)
{
if(st1[i]==st2[i])
{
if(i==l1)
{
printf("two strings are equal");
}

}
else
goto label:
}
}
else
goto label:
label:printf("not equal");
}

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what value is returned to operating system after program execution?

1698


What are the application of c?

740


What is the scope of static variables in c language?

729


int i=10; printf("%d %d %d", i, i=20, i);

1118


How many levels of indirection in pointers can you have in a single declaration?

698






How would you use the functions fseek(), freed(), fwrite() and ftell()?

795


What is break statement?

727


Are bit fields portable?

792


What is a keyword?

856


What is c preprocessor mean?

897


Why is not a pointer null after calling free? How unsafe is it to use (assign, compare) a pointer value after it is been freed?

701


When would you use a pointer to a function?

672


What are the different types of endless loops?

722


What is static memory allocation?

716


What is the meaning of typedef struct in c?

691