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
Why cant I open a file by its explicit path?
Is Exception handling possible in c language?
#include
What's a good way to check for "close enough" floating-point equality?
What are the types of data files?
Can we declare variable anywhere in c?
Explain how do you determine the length of a string value that was stored in a variable?
What does the characters “r” and “w” mean when writing programs that will make use of files?
What are volatile variables in c?
What is the difference between declaring a variable by constant keyword and #define ing that variable?
What is the purpose of type declarations?
a direct address that identifies a location by means of its displacement from a base address or segment a) absolute address b) relative address c) relative mode d) absolute mode
how many errors in c explain deply
What are the advantages and disadvantages of c language?
What is a structural principle?