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
Do character constants represent numerical values?
Should I learn c before c++?
What are the advantages of using new operator as compared to the function malloc ()?
What is c standard library?
What does %p mean?
What are keywords in c with examples?
What is the difference between formatted&unformatted i/o functions?
Define circular linked list.
Discuss the function of conditional operator, size of operator and comma operator with examples.
Is fortran faster than c?
Dont ansi function prototypes render lint obsolete?
An application package has been provided to you without any documents for the following application. The application needs to be tested. How will you proceed?
Explain what are header files and explain what are its uses in c programming?
What is a node in c?
What is omp_num_threads?