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
What is use of integral promotions in c?
What is the use of putchar function?
What are the application of c?
Should I learn c before c++?
What is the use of bit field?
Why is it that not all header files are declared in every C program?
What are c preprocessors?
what do you mean by inline function in C?
write a program that declares an array of 30 elements named "income" in the main functions. then cal and pass the array to a programmer-defined function named "getIncome" within the "getIncome" function, ask the user for annual income of 30 employees. then calculate and print total income on the screen using the following function: "void getIncome ( ai []);
What is LINKED LIST? How can you access the last element in a linked list?
Write a program to find factorial of a number using recursive function.
#include main() { char s[] = "Bouquets and Brickbats"; printf(" %c, ",*(&s[2])); printf("%s, ",s+5); printf(" %s",s); printf(" %c",*(s+2)); }
When was c language developed?
how is the examination pattern?
How can you increase the size of a dynamically allocated array?