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
What are the types of data files?
What is the most efficient way to store flag values?
In a switch statement, what will happen if a break statement is omitted?
Explain with the aid of an example why arrays of structures don’t provide an efficient representation when it comes to adding and deleting records internal to the array.
How to find a missed value, if you want to store 100 values in a 99 sized array?
Write a program to check whether a number is prime or not using c?
the number of measuring units from a arbitrary starting point in a record area or control block to some other point a) branching b) recording pointer c) none d) offset
Explain what is operator promotion?
Write a C++ program to generate 10 integer numbers between - 1000 and 1000, then store the summation of the odd positive numbers in variable call it sum_pos, then find the maximum digit in this variable regardless of its digits length.
WHAT IS THE DEFINATION OF IN TECHNOLOGY AND OFF TECHNOLOGY ?
What is output redirection?
What are structures and unions? State differencves between them.
Which is better malloc or calloc?
Is void a keyword in c?
What are the advantages of the functions?