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 value is returned to operating system after program execution?
What are the application of c?
What is the scope of static variables in c language?
int i=10; printf("%d %d %d", i, i=20, i);
How many levels of indirection in pointers can you have in a single declaration?
How would you use the functions fseek(), freed(), fwrite() and ftell()?
What is break statement?
Are bit fields portable?
What is a keyword?
What is c preprocessor mean?
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?
When would you use a pointer to a function?
What are the different types of endless loops?
What is static memory allocation?
What is the meaning of typedef struct in c?