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

Given two strings S1 and S2. Delete from S2 all those characters which occur in S1 also and finally create a clean S2 with the relevant characters deleted.

837


Write a program to print ASCII code for a given digit.

689


Can the sizeof operator be used to tell the size of an array passed to a function?

621


What are the 4 types of functions?

574


What are static variables in c?

630






What is use of bit field?

775


What does p mean in physics?

586


What are enumerated types?

656


What are c identifiers?

630


How can you increase the size of a dynamically allocated array?

644


What is "Hungarian Notation"?

638


What is a function in c?

575


Define Spanning-Tree Protocol (STP)

646


What is use of pointer?

588


What is uint8 in c?

643