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

Explain what is the concatenation operator?

880


int far *near * p; means

3341


What's the total generic pointer type?

858


Where in memory are my variables stored?

883


How can a number be converted to a string?

961


When is a “switch” statement preferable over an “if” statement?

891


What are the header files used in c language?

822


A c program to display count values from 0 to 100 and flash each digit for a secong.reset the counter after it reaches 100.use for loop,. pls guys hepl me.. :(

2032


Explain what are multibyte characters?

894


Why is struct padding needed?

852


What is the difference between typedef struct and struct?

874


Can a local variable be volatile in c?

792


How can I rethow can I return a sequence of random numbers which dont repeat at all?

996


What language is c written?

775


What is the difference between the local variable and global variable in c?

762