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
Given two strings S1 and S2. Delete from S2 all those characters which occur in S1 also and finally create a clean S2 with the relevant characters deleted.
Write a program to print ASCII code for a given digit.
Can the sizeof operator be used to tell the size of an array passed to a function?
What are the 4 types of functions?
What are static variables in c?
What is use of bit field?
What does p mean in physics?
What are enumerated types?
What are c identifiers?
How can you increase the size of a dynamically allocated array?
What is "Hungarian Notation"?
What is a function in c?
Define Spanning-Tree Protocol (STP)
What is use of pointer?
What is uint8 in c?