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

Answer Posted / mallesh

#include<stdio.h>
#include<conio.h>
int xstrcmp(char*,char*);
void main()
{
int c;
char a1[20],a2[20];
printf("Enter the two string's :\n");
gets(a1);
gets(a2);
c=xstrcmp(&a1[0],&a2[0]);
printf("%d",c);
getch();
}
int xstrcmp(char *a,char *a1)
{

while((*a)==(*a1))
{
if((*a=='\0')||(*a1=='\0'))
break;
++(a);
++(a1);
}
return((*a)-(*a1));
}

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what is the diffrenet bettwen HTTP and internet protocol

1598


How can you determine the maximum value that a numeric variable can hold?

901


Is it acceptable to declare/define a variable in a c header?

886


What functions are in conio h?

899


What is variable in c example?

821


What does c mean before a date?

851


How do you print an address?

986


In this problem you are to write a program that will cut some number of prime numbers from the list of prime numbers between 1 and N.Your program will read in a number N; determine the list of prime numbers between 1 and N; and print the C*2 prime numbers from the center of the list if there are an even number of prime numbers or (C*2)-1 prime numbers from the center of the list if there are an odd number of prime numbers in the list.

1616


How can you read a directory in a C program?

898


How will you print TATA alone from TATA POWER using string copy and concate commands in C?

1166


What is formal argument?

891


Tell me what is the purpose of 'register' keyword in c language?

825


What is indirection?

846


How many keywords are there in c?

821


What is ponter?

1028