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
what are the advantages of a macro over a function?
What is variables in c?
What is floating point constants?
Differentiate between new and malloc(), delete and free() ?
Can we change the value of #define in c?
What are global variables and how do you declare them?
What is the difference between typedef struct and struct?
What is difference between arrays and pointers?
the portion of a computer program within which the definition of the variable remains unchanged a) mode b) module c) scope d) none
1234554321 1234 4321 123 321 12 21 1 1 12 21 123 321 1234 4321 1234554321
int far *near * p; means
Explain void pointer?
what are non standard function in c
How to establish connection with oracle database software from c language?
What language is c written?