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

Write a program which returns the first non repetitive character in the string?

597


write a progrmm in c language take user interface generate table using for loop?

1571


c language supports bitwise operations, why a) 'c' language is system oriented b) 'c' language is problem oriented c) 'c' language is middle level language d) all the above

608


What is c++ used for today?

660


int i=10; printf("%d %d %d", i, i=20, i);

1007






Where we use clrscr in c?

699


What is a rvalue?

743


main() { printf("hello"); fork(); }

692


Does free set pointer to null?

555


What is realloc in c?

581


Write a program with dynamically allocation of variable.

600


What is the significance of c program algorithms?

676


What is integer constants?

615


Should I use symbolic names like true and false for boolean constants, or plain 1 and 0?

597


How is a macro different from a function?

652