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


Please Help Members By Posting Answers For Below Questions

what are the advantages of a macro over a function?

648


What is variables in c?

610


What is floating point constants?

694


Differentiate between new and malloc(), delete and free() ?

676


Can we change the value of #define in c?

587






What are global variables and how do you declare them?

622


What is the difference between typedef struct and struct?

602


What is difference between arrays and pointers?

584


the portion of a computer program within which the definition of the variable remains unchanged a) mode b) module c) scope d) none

651


1234554321 1234 4321 123 321 12 21 1 1 12 21 123 321 1234 4321 1234554321

3146


int far *near * p; means

3123


Explain void pointer?

593


what are non standard function in c

1438


How to establish connection with oracle database software from c language?

1678


What language is c written?

578