write a own function to compare two strings with out using
stringcomparition function?

Answer Posted / vignesh1988i

sorry ... i made a small logical problem in a above posted
answer ... so this program will work out correctly.....

#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 ?    2 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

c language interview questions & answer

1455


An integer that indentifies the position of a data item in a sequence of data items a) value b) number c) index d) all of the above

645


What is scope rule in c?

603


What is calloc() function?

621


Give me the code of in-order recursive and non-recursive.

882






List some applications of c programming language?

545


What is use of null pointer in c?

563


What are qualifiers and modifiers c?

543


What is the use of printf() and scanf() functions?

628


Explain about the functions strcat() and strcmp()?

596


find out largest elemant of diagonalmatrix

1646


In C, What is the #line used for?

1047


What is the acronym for ansi?

626


count = 0; for (i = 1;i < = 10; i++);count = count + i; Value of count after execution of the above statements will be a) 0 b) 11 c) 55 d) array

673


Process by which one bit pattern in to another by bit wise operation is?

613