write a own function to compare two strings with out using
stringcomparition function?
Answer Posted / vignesh1988i
#include<stdio.h>
#include<conio.h>
int xstrcmp(char*,char*);
void main()
{
int c;
char a1[20],a2[20];
printf("enter the two strings :");
gets(a1);
gets(a2);
c=xstrcmp(&a1[0],&a2[0]);
printf("%d",c);
getch();
}
int xstrcmp(char *a,char *a1)
{
if((*a)!=(*a1))
return((*a)-(*a1));
else if((*a)!='\0' && (*a1)!='\0')
{
(*a)++;
(*a1)++;
xstrcmp(a,a1);
}
else
return 0;
}
Is This Answer Correct ? | 5 Yes | 6 No |
Post New Answer View All Answers
Explain what is the concatenation operator?
int far *near * p; means
What's the total generic pointer type?
Where in memory are my variables stored?
How can a number be converted to a string?
When is a “switch” statement preferable over an “if” statement?
What are the header files used in c language?
A c program to display count values from 0 to 100 and flash each digit for a secong.reset the counter after it reaches 100.use for loop,. pls guys hepl me.. :(
Explain what are multibyte characters?
Why is struct padding needed?
What is the difference between typedef struct and struct?
Can a local variable be volatile in c?
How can I rethow can I return a sequence of random numbers which dont repeat at all?
What language is c written?
What is the difference between the local variable and global variable in c?