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
Why do we need a structure?
What is the right type to use for boolean values in c?
What is ponter?
What is typedef struct in c?
Define VARIABLE?
how many key words availabel in c a) 28 b) 31 c) 32
Who developed c language?
What is size of union in c?
Sir i need notes for structure,functions,pointers in c language can you help me please
code for replace tabs with equivalent number of blanks
What is a ternary operator in c?
What is a keyword?
Explain the use of bit fieild.
Write a C program on Centralized OLTP, Decentralized OLTP using locking mechanism, Semaphore using locking mechanism, Shared memory, message queues, channel of communication, sockets and a simple program on Saving bank application program using OLTP in IPC?
What is variable in c example?