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
What is the difference between %d and %i?
What is NULL pointer?
What is a rvalue?
Describe how arrays can be passed to a user defined function
How can I call a function with an argument list built up at run time?
What is variable in c example?
Is c is a high level language?
Explain how can I open a file so that other programs can update it at the same time?
Can we declare variables anywhere in c?
Explain what is the benefit of using #define to declare a constant?
What is the use of a semicolon (;) at the end of every program statement?
Is c# a good language?
What is gets() function?
Explain what is output redirection?
What is wrong in this statement? scanf(ā%dā,whatnumber);