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

find the value of y y = 1.5x+3 for x<=2 y = 2x+5 for x>2

1530


How do we print only part of a string in c?

587


What is the use of ?

627


How can you increase the allowable number of simultaneously open files?

598


‘SAVEPOINT’ and ‘ROLLBACK’ is used in oracle database to secure the data comment. Give suitable examples of each with sql command.

1880






What is multidimensional arrays

634


Define recursion in c.

703


What is the difference between the local variable and global variable in c?

533


Tell me what is the purpose of 'register' keyword in c language?

620


What are the types of data files?

730


What are terms in math?

595


define string ?

669


Why is void main used?

622


What is the difference between union and anonymous union?

836


What is pre-emptive data structure and explain it with example?

3213