Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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

how to find binary of number?

4341


What is the meaning of 2d in c?

1065


write a c program to print the next of a particular no without using the arithmetic operator or looping statements?

3844


Can we use any name in place of argv and argc as command line arguments?

1016


application areas a 'c' a) operating system b) graphics, interpreter, assembler c) program evalution, communication softwares d) all the above

1016


What is hashing in c?

1103


What is typedef?

1339


Explain how do you list a file’s date and time?

990


Why is c called a structured programming language?

1216


When we use void main and int main?

1019


difference between native and cross compilers

2083


How is actual parameter different from the formal parameter?

973


Why pointers are used?

1026


What is getch () for?

1150


If I have a char * variable pointing to the name of a function ..

1117