write a own function to compare two strings with out using
stringcomparition function?
Answer Posted / mallesh
#include<stdio.h>
#include<conio.h>
int xstrcmp(char*,char*);
void main()
{
int c;
char a1[20],a2[20];
printf("Enter the two string's :\n");
gets(a1);
gets(a2);
c=xstrcmp(&a1[0],&a2[0]);
printf("%d",c);
getch();
}
int xstrcmp(char *a,char *a1)
{
while((*a)==(*a1))
{
if((*a=='\0')||(*a1=='\0'))
break;
++(a);
++(a1);
}
return((*a)-(*a1));
}
Is This Answer Correct ? | 0 Yes | 1 No |
Post New Answer View All Answers
Which programming language is best for getting job 2020?
Write a program to find factorial of a number using recursive function.
What is I ++ in c programming?
What is a lvalue
Differentiate between Macro and ordinary definition.
What is difference between scanf and gets?
Write a program to check palindrome number in c programming?
Explain how can a program be made to print the name of a source file where an error occurs?
What does calloc stand for?
All technical questions
Can we increase size of array in c?
What is 02d in c?
What is the right way to use errno?
What is the difference between functions abs() and fabs()?
Can the “if” function be used in comparing strings?