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
c language interview questions & answer
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
What is scope rule in c?
What is calloc() function?
Give me the code of in-order recursive and non-recursive.
List some applications of c programming language?
What is use of null pointer in c?
What are qualifiers and modifiers c?
What is the use of printf() and scanf() functions?
Explain about the functions strcat() and strcmp()?
find out largest elemant of diagonalmatrix
In C, What is the #line used for?
What is the acronym for ansi?
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
Process by which one bit pattern in to another by bit wise operation is?