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
How will you declare an array of three function pointers where each function receives two ints and returns a float?
What is data structure in c programming?
Is null a keyword in c?
Explain is it valid to address one element beyond the end of an array?
What is extern c used for?
How do you print only part of a string?
Explain what math functions are available for integers? For floating point?
Is there any algorithm to search a string in link list in the minimum time?(please do not suggest the usual method of traversing the link list)
exit () is used to a) exit () terminates the execution of the program itself b) exit () terminates the execution of the loop c) exit () terminates the execution of the block d) none of the above
A function can make the value of a variable available to another by a) declaring the variable as global variable b) Passing the variable as a parameter to the second function c) Either of the two methods in (A) and (B) d) binary stream
Explain the Difference between the New and Malloc keyword.
Stimulate calculator using Switch-case-default statement for two numbers
typedef struct{ char *; nodeptr next; } * nodeptr ; What does nodeptr stand for?
What is #line in c?
What are the advantages of c language?